Datasheet

129
2466T–AVR–07/10
ATmega16(L)
When OC2 is connected to the pin, the function of the COM21:0 bits depends on the WGM21:0
bit setting. Table 51 shows the COM21:0 bit functionality when the WGM21:0 bits are set to a
normal or CTC mode (non-PWM).
Table 52 shows the COM21:0 bit functionality when the WGM21:0 bits are set to fast PWM
mode.
Note: 1. A special case occurs when OCR2 equals TOP and COM21 is set. In this case, the compare
match is ignored, but the set or clear is done at BOTTOM. See “Fast PWM Mode” on page 123
for more details.
Table 53 shows the COM21:0 bit functionality when the WGM21:0 bits are set to phase correct
PWM mode
.
Note: 1. A special case occurs when OCR2 equals TOP and COM21 is set. In this case, the compare
match is ignored, but the set or clear is done at TOP. See “Phase Correct PWM Mode” on page
124 for more details.
Table 51. Compare Output Mode, non-PWM Mode
COM21 COM20 Description
0 0 Normal port operation, OC2 disconnected.
0 1 Toggle OC2 on compare match
1 0 Clear OC2 on compare match
1 1 Set OC2 on compare match
Table 52. Compare Output Mode, Fast PWM Mode
(1)
COM21 COM20 Description
0 0 Normal port operation, OC2 disconnected.
01Reserved
1 0 Clear OC2 on compare match, set OC2 at BOTTOM,
(non-inverting mode)
1 1 Set OC2 on compare match, clear OC2 at BOTTOM,
(inverting mode)
Table 53. Compare Output Mode, Phase Correct PWM Mode
(1)
COM21 COM20 Description
0 0 Normal port operation, OC2 disconnected.
01Reserved
1 0 Clear OC2 on compare match when up-counting. Set OC2 on compare
match when downcounting.
1 1 Set OC2 on compare match when up-counting. Clear OC2 on compare
match when downcounting.