I am trying to set up a CTC timer to blink an led for 1 second on pin PC0 but I cant get it to work. The led wont blink at all. Any help is much appreciated, thanks
#define F_CPU 8000000UL #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> void timer1_init() { TCCR1B |= (1 << WGM12)|(1 << CS12); //sets up timer with prescaler 256 and CTC mode TCNT1 = 0; //initialize counter OCR1A = 15623; //initialize compare value TIMSK1 |= (1 << OCIE1A); //enable compare interrupt } ISR(TIMER1_COMPA_vect) //Interrupt service routine { PORTC ^= (1 << 0); //Toggle led } int main(void) { sei(); DDRC |= (1 << 0); timer1_init(); //Initialize timer 1 while(1) { } }