Hi Guys,
I need to write some PWM signals with higher resolution than the built-in functions allow, so I tried to use the 16-bit timers of the ATMega to generate the signal, but I dont get an output.
I used Timer3 in Mode 8 (Phase and frequency correct PWM) and Comparator Mode 3. With a counting frequency of clk/8 I use 10000 as TOP to get a PWM frequency of 100Hz and I set OCR3A to 8500 to get a duty cycle of 1500µs.
Does anyone see, why this doesn’t work?
void setup() {
pinMode(2,OUTPUT);
ICR3 = 10000;
TCCR3A = (1<<COM3A1)|(1<<COM3A0);
TCCR3B = (1<<WGM33)|(1<<CS31);
OCR3A = 8500;
TCNT3 = 0;
sei();
}
void loop() {
}
Thanks for replies