Rev Author Line No. Line
2925 poskozby 1 /*
2 * Timers.c
3 *
4 * Created: 17.4.2013 19:04:37
5 * Author: Zbynek
6 */
7  
8 #include <avr/io.h>
9  
10 void Timer1_init(void)
11 {
12 TCCR1B |= 1<<WGM12; // T1 in CTC mode
13 TCCR1B |= 1<<CS12; // f_osc/1024
14 TCCR1B |= 1<<CS10; // f_osc/1024
15  
16 OCR1AH = 0xF4; // Start value in counter ~4s
17 OCR1AL = 0x24;
18  
19 TCNT1H = 0; // Start value in counter
20 TCNT1L = 0;
21  
22  
23 TIMSK1 |= 1<<OCIE1A; // enable interrupt from T1 when compare match
24 }
25