Hi, everyone…
After I succeed with my first interrupt program, I want develope that with the global variabel. Does everyone know how to make a global variabel works in main program? The global variabel must been updated in the interrupt routine. I make some program, but the global variabel that I’ve made, didn’t show updated in the main program.
here is my example program:
int a; /* a is a global variabel*/
int main (void)
{
…
…
while (1)
{
IOPIN = a;
}
}
void IRQ_Routine(void)
{
a–;
if(a==0x0)
a = 0xFFFE;
T1IR = 0x01;
VICVectAddr = 0xff;
}
from the example, the global variabel will be updated every time the interrupt occurs. Then, “a” will be shown (using IOPIN). But, what is happening is not like that. The “a” never been updated…
Did everyone can help me to solve my problem???
regards,
Hesanj