Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Init_Timer1(void)
- {
- TCCR1A = 0x00;
- TCCR1B = _BV(CS11) | _BV(WGM12); // clk/8 and normal count up
- TCCR1C = 0x00;
- OCR1A = TIMERTICKS;
- TIMSK1 = _BV(OCIE1A); //enable compareA ISR
- }
- and
- ISR(TIMER1_COMPA_vect)
- {
- TGL_LEDY();
- }
- With this in the main loop somewhere:
- main(void)
- {
- Init_Timer1();
- foo...
- sei(); //init global irqs.
- bar...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement