
/**************************************************************************
Name            - init_timer1()
Parameters      - None
Responsibility  - Initialize timer/counter1 to establish a time base

Notes           -

Returns         - Nothing
Author          - wje
 **************************************************************************/


#include <inttypes.h>
#include <stdlib.h>
#include <avr/io.h>
#include <avr/interrupt.h>


#define PRESCALER_1024  0x05
#define PRESCALER_64    0x03

void init_timer1(void) {

    // use the 64 prescaler with the 8 MHZ external resonator
    TCCR1A = 0;
    TCCR1B = PRESCALER_64;
    // initialize cournter registers for a 5 ms overflow (interrupt)
    TCNT1 = 0xfd8e; //a decimal 625 count to overflow (interrupt)
}
