Hi - I'm seeing no output from the OC1A pin on an ATMEGA168. It just sits at low.
Here is the relevant code:
DDRB = 0b00101010; PORTB = 0b11000111; //Initialize PWM //timer 1, output on OC1A //COM1A1 = 1, COM1A0 =10 (clear OC1A at bottom, set it on compare match) //WGM13:0 = 1110, Fast PWM, top = ICR1 //clock = IO clock/1 TCCR1A = (1<<COM1A1) | (1<<COM1A0) | (1<<WGM11); TCCR1B = (1<<WGM13) | (1<<WGM12) | (1<<CS10); TCNT1 = 31; //8E6 / 250E3 = 32 OCR1A = 16; //start out with a very small number
I suspect I'm missing a bit somewhere. Any suggestions? I'm expecting a 250KHz PWM with 50% duty cycle.