5d0b0690871cc8710ca8b2796b8d0a8ca083021e
[simavr] / tests / atmega48_disabled_timer.c
1 /*
2  * avrtest.c
3  *
4  *  Created on: 1 Dec 2009
5  *      Author: jone
6  */
7
8 #include <avr/io.h>
9 #include <avr/interrupt.h>
10
11 #include "avr_mcu_section.h"
12 AVR_MCU(F_CPU, "atmega48");
13
14 ISR(TIMER0_COMPA_vect)
15 {
16         TCCR0B = 0;
17         TCNT0 = 0;
18 }
19
20 int main(void)
21 {
22         // Set up timer0 - do not start yet
23         TCCR0A |= (1 << WGM01);                     // Configure timer 0 for CTC mode
24         TIMSK0 |= (1 << OCIE0A);                    // Enable CTC interrupt
25         OCR0A   = 0xAA;                             // CTC compare value
26
27         sei();                                      // Enable global interrupts
28
29         // here the interupts are enabled, but the interupt
30         // vector should not be called
31         while(1)
32                 ;
33 }