I try to make a pwm with a 1,563 hz frequency but I have problems changing the duty cicle.
const byte n = 9;
TCCR2A = bit (WGM20) | bit (WGM21) | bit (COM2B1);
TCCR2B = bit (WGM22) | bit (CS22) | bit (CS21) | bit (CS20);
OCR2A = n;
OCR2B = ((n + 1) / 2) - 1; // 50% duty cycle
I know OCR2B is 8 bit and 255 values
but according to above I can use only 9 steps of duty cicle.
how can I use the full range of 255 steps and still have the 1,563 hz frequency?
thank you.