/*
 * Timers.c
 *
 * Created: 17.4.2013 19:04:37
 *  Author: Zbynek
 */ 

#include <avr/io.h>

void Timer1_init(void)
{
                TCCR1B |= 1<<WGM12;             // T1 in CTC mode
                TCCR1B |= 1<<CS12;              // f_osc/1024
                TCCR1B |= 1<<CS10;              // f_osc/1024

                OCR1AH = 0xF4;          // Start value in counter  ~4s          
                OCR1AL = 0x24;

                TCNT1H = 0;                     // Start value in counter               
                TCNT1L = 0;

                
                TIMSK1 |= 1<<OCIE1A;    // enable interrupt from T1 when compare match
}