HI All,
weirdest problem. I have a global variable named maxADR which supposed
to hold the value of the last A to D conversion that was greater than
zero, problem is it gets erased after each interrupt routine! Here's
how I'm doing it:
#include <stdio.h>
....
unsigned char maxADR;
....
void main(void){
....
asm CLR;
for (;;){
//do nothing
}
interrupt 16 void ADC_ISR(void){
if (maxADR > 1) doLights();
...
if (ADR > 15) maxADR = ADR/15;
adrval = ADR;
}
funny thing is as soon as the ADR goes to zero, it seems like maxADR
falls below 1 too ! WHY? anyone know why it's losing its value?
Thanks,
Aria