Advertisement
Guest User

Untitled

a guest
Jun 29th, 2013
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void Init_Timer1(void)
  2. {
  3. TCCR1A = 0x00;
  4. TCCR1B = _BV(CS11) | _BV(WGM12); // clk/8 and normal count up
  5. TCCR1C = 0x00;
  6. OCR1A = TIMERTICKS;
  7. TIMSK1 = _BV(OCIE1A); //enable compareA ISR
  8. }
  9.  
  10. and
  11.  
  12. ISR(TIMER1_COMPA_vect)
  13. {
  14. TGL_LEDY();
  15. }
  16.  
  17. With this in the main loop somewhere:
  18.  
  19. main(void)
  20. {
  21. Init_Timer1();
  22. foo...
  23. sei(); //init global irqs.
  24. bar...
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement