1 compare output mode and waveform generation, Atmega128rfa1 – Rainbow Electronics ATmega128RFA1 User Manual
Page 318

318
8266A-MCU Wireless-12/09
ATmega128RFA1
Figure 21-7. Compare Match Output Unit, Schematic
PORT
DDR
D
Q
D
Q
OCnx
Pin
OCnx
D
Q
Waveform
Generator
COMnx1
COMnx0
0
1
D
A
T
A B
US
FOCn
clk
I/O
21.7.1 Compare Output Mode and Waveform Generation
The Waveform Generator uses the COM2x1:0 bits differently in normal, CTC, and PWM
modes. Setting the COM2x1:0 = 0 for all modes tells the Waveform Generator that no
action on the OC2x Register is to be performed on the next compare match. For
compare output actions in the non-PWM modes for fast PWM mode and for phase
correct PWM refer to section
"Register Description" on page 323
for register TCCR2A.
A change of the COM2x1:0 bits state will have effect at the first compare match after
the bits are written. For non-PWM modes, the action can be forced to have immediate
effect by using the FOC2x strobe bits.
The following table shows the COM2x1:0 bit functionality when the WGM02:0 bits are
set to a normal or CTC mode (non-PWM).
Table 21-3. Compare Output Mode, non-PWM Mode
COM2x1
COM2x0
Description
0
0
Normal port operation, OC2x disconnected;
0
1
Toggle OC2x on Compare Match;
1
0
Clear OC2x on Compare Match;
1
1
Set OC2x on Compare Match;
Table 17-3 shows the COM2x1:0 bit functionality when the WGM21:0 bits are set to fast
PWM mode.
Table 21-4. Compare Output Mode, Fast PWM Mode
COM2x1
COM2x0
Description
0
0
Normal port operation, OC2x disconnected.
0
1
WGM22 = 0: Normal Port Operation, OC2A Disconnected.
WGM22 = 1: Toggle OC2A on Compare Match.
OC2B: not applicable, reserved function;