I have a simple program which turns the LED on and off when the RTC expires. Here is the ISR code.
interrupt void RTC_Isr(void)
{
Uint16 temp;
// clear RTC int flag
IFR1 = 0x0004;
temp =RTC_STAT;
RTC_STAT = temp;
if((ST1_55&0x2000) != 0)
{
// turn off LED
ST1_55 &=0xDFFF;
}
else
{
//turn on LED
ST1_55 |=0x2000;
}
}
The code executes correctly, and the led turns on and off at the correct times, however when the ISR exits, if the LED was turned on, it immediately turns off. Why??