added timer0 isr and init

This commit is contained in:
john stone 2012-07-26 01:34:49 +02:00
parent bdb309c58c
commit f9043353b1

View File

@ -6,6 +6,28 @@
#include "main.h" #include "main.h"
//25kHz
ISR (TIMER0_OVF_vect)
{
}
static void init_sampletimer(void)
{
// Timer 0
//
//set timer0 to CTC & prescaler 64 == 125k
TCCR0A = (1<<WGM01);
TCCR0B = (1<<CS00)|(1<<CS01);
//count up to 5 :
OCR0A = 5;
//enable interrupt
TIMSK0 |= (1<<TOIE0);
}
static inline void init_pwm(void) static inline void init_pwm(void)
{ {
//PB1 set to output: //PB1 set to output: