First page Back Continue Last page Graphics
Interrupt Service Routine (continued)
- //------------------------------------------------
- // increment a count of 12 samples in 10msec
- // 12*1/1200 sec = 1/100 sec
- //------------------------------------------------
- tick12Count++;
- //------------------------------------------------
- // if 10msec passed, increment legacy 10msec counter
- //------------------------------------------------
- if (tick12Count >= 12) {
- tickCount++;
- tick12Count = 0;
- if (--tickHelper == 0) {
- tickHelper = TICKS_PER_SECOND;
- tickSec++;
- }
- }
- //------------------------------------------------
- // Set ADC to convert newly selected input
- // to be read upon next ISR
- //------------------------------------------------
- ADCON0_ADON = 1;
- ADCON0_GO = 1;
- The Modtronix web server has a 10msec “tickCount” counter
- This corresponds to 12 interrupts at 1200Hz, so increment a tick12Counter every interrupt
- Everytime tick12Counter passes 12, reset it, and count the legacy “tickCount”
- Last thing we do in the ISR routine is to trigger the A/D converter to take another measurement