Hallo ALL, I have the following problem .... I use F005 from cygnal. I have a timer: ...................................... idata U8 volatile HeartbeatLEDTimer; idata U8 volatile DACTimer; ................................... void Timer0InterruptHandler(void) interrupt 1 using 1 { // Reload the timer registers TR0 = 0; TL0 = T0_RELOAD_LOW; TH0 = T0_RELOAD_HIGH; // DECREMENT_TIMER(HeartbeatLEDTimer); DECREMENT_TIMER(DACTimer); TR0 = 1; } and in the main() /* if(!HeartbeatLEDTimer) {pin_LED_D1 = ~pin_LED_D1; HeartbeatLEDTimer = HEART_BEAT_LED_TIMER;} */ ............................. // INTERRUPTS_OFF; DACTimer=DAC_TIMER; // INTERRUPTS_ON; while(DACTimer != 0){; }//delay it works without INTERRUPTS_OFF if I don't use HeartbeatLEDTimer, but if I use it, I should disable interrupts only before DACTimer=DAC_TIMER and not before HeartbeatLEDTimer = HEART_BEAT_LED_TIMER??? I'm really confused and I thought the problem is in VOLATILE! But it's not so clear. Please help me to understand what here is really happened. With best regards, Sergey
View all questions in Keil forum