First page Back Continue Last page Graphics
Interrupt Service Routine (continued)
- //------------------------------------------------
- // reset temp's for next pair of 60hz cycles
- //------------------------------------------------
- tick20Count = 0;
- max_sample = 0;
- min_sample = 0;
- Intermediate2 = 8192;
- Intermediate1 = 8192;
- metric = 0;
- //------------------------------------------------
- // advance breaker number, mod ADC_CHANNELS
- //------------------------------------------------
- breakerNumber++;
- if (breakerNumber >= ADC_CHANNELS)
- breakerNumber = 0;
-
- //------------------------------------------------
- // output transducer board address,
- // and select PIC ADC input for next 60hz cycle
- //------------------------------------------------
- ADCON1 = 0x0B;
- TRISF = 0x00;
- LATF = ((breakerNumber&0x3C)<<2) | ((breakerNumber&0x3C)>>2);
- ADCON0 &= ~0x3C;
- ADCON0 |= (breakerNumber&&0x03)<< 2;
- }
- Restore temp variables to starting values for next input measurement
- Step to the next breaker number,
- modulo ADC_CHANNELS
- The least significant 2 bits of breaker address will select which of the 4 analog inputs to A/D sample.
- The next 4 bits of breaker address are written to PIC outputs to select interface board, and one of the 4016 chips on that interface board