transcode/examples/int.c

21 lines
289 B
C
Raw Permalink Normal View History

2011-07-11 12:15:35 +02:00
#include <avr/io.h>
#include <avr/interrupt.h>
uint8_t state = 0;
int main ( void ) {
/* initialize timer */
TCCR0 |= (1 << CS01) | (1 << CS00) | (1 << WGM01);
OCR0 = 123;
TIMSK |= (1 << OCIE0);
TIFR |= (1 << OCF0);
2011-07-13 00:42:27 +02:00
2011-07-11 12:15:35 +02:00
sei();
2011-07-13 00:42:27 +02:00
return 0;
2011-07-11 12:15:35 +02:00
}
ISR(TIMER0_COMP_vect) {
state ^= 0xff;
}