/* timer.c */ /* include these header files */ #include /* system header files are surrounded by <>'s */ #include #include "sample.h" /* user header files are surrounded by "'s */ /* external global variable: defined in sample.c, but used here */ extern volatile unsigned char timer_step; /* An interrupt routine -- you can call it, but the AVR processor calls it when the timer expires -- see for interrupt types */ SIGNAL(SIG_OVERFLOW1) { TCNT1 = 0; /* reset TCNT1 */ TCCR1B = PRSC1_SELECT; /* set count rate */ timer_step++; /* increment slow counter */ } /* function */ void timer_init(void) { TIMSK = (1<