interrupts: Do not clear raised bit twice
[simavr] / tests / atmega48_disabled_timer.c
index 2ccfaf8..332bbc9 100644 (file)
@@ -14,8 +14,6 @@ AVR_MCU(F_CPU, "atmega48");
 
 ISR(TIMER0_COMPA_vect)
 {
-       TCCR0B = 0;
-       TCNT0 = 0;
 }
 
 int main(void)
@@ -25,10 +23,15 @@ int main(void)
        TIMSK0 |= (1 << OCIE0A);                    // Enable CTC interrupt
        OCR0A   = 0xAA;                             // CTC compare value
 
+       //TCCR0B |= (1 << CS00) | (1 << CS01);        // Start timer: clk/64
+
        sei();                                      // Enable global interrupts
 
        // here the interupts are enabled, but the interupt
        // vector should not be called
-       while(1)
-               sleep_mode();
+       sleep_mode();
+
+       // this should not be reached
+       cli();
+       sleep_mode();
 }