Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- #include <avr/delay.h>
- #include <avr/interrupt.h>
- ISR(TIMER0_OVF)
- {
- PORTB ^= 1;
- }
- int main(void)
- {
- DDRB |= (1 << PB1); // set PB1 as output
- PORTB |= (1 << PB1); // led on
- TIMSK0 |= (1 << TOIE0); // enable timer overflow interrupt
- TCCR0B |= (1 << CS00) | (1 << CS02); //set prescaler to 1024
- sei();
- while(1)
- {
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment