Guest User

Untitled

a guest
Jun 30th, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <avr/io.h>
  2. #include <avr/delay.h>
  3. #include <avr/interrupt.h>
  4.  
  5. ISR(TIMER0_OVF)
  6. {
  7. PORTB ^= 1;
  8. }
  9.  
  10. int main(void)
  11. {
  12. DDRB |= (1 << PB1); // set PB1 as output
  13. PORTB |= (1 << PB1); // led on
  14. TIMSK0 |= (1 << TOIE0); // enable timer overflow interrupt
  15. TCCR0B |= (1 << CS00) | (1 << CS02); //set prescaler to 1024
  16.  
  17. sei();
  18. while(1)
  19. {
  20. }
  21.  
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment