I am trying to use Timer2 in an Uno in fast PWM mode. Can someone explain how to set up the TCCR2A & B registers?
Currently I have:
TCCR2A |= _BV(WGM21) | _BV(WGM20); TCCR2B &= ~_BV(WGM22); TCCR2A = (TCCR2A | _BV(COM2A1)) & ~_BV(COM2A0); TCCR2A &= ~(_BV(COM2B1) | _BV(COM2B0)); TCCR2B = (TCCR2B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10);
I would like to have the inverted value on TCCR2B, but I think it can be inverted using OCR2B ^= 255, correct? This is to have a varying signal on Pin11 and its inverse on Pin3, the signal is generated by varying the OCR2B value.