Datasheet

Table Of Contents
the Data Direction Register (DDR) bit corresponding to the OC0 pin must be set in order to enable the
output driver.
When OC0 is connected to the pin, the function of the COM01:0 bits depends on the WGM01:0 bit
setting. The following table shows the COM01:0 bit functionality when the WGM01:0 bits are set to a
normal or CTC mode (non-PWM).
Table 21-3. Compare Output Mode, Non-PWM Mode
COM01 COM00 Description
0 0 Normal port operation, OC0 disconnected.
0 1 Toggle OC0 on Compare Match
1 0 Clear OC0 on Compare Match
1 1 Set OC0 on Compare Match
The next table shows the COM01:0 bit functionality when the WGM01:0 bits are set to fast PWM mode.
Table 21-4. Compare Output Mode, Fast PWM Mode
(1)
COM01 COM00 Description
0 0 Normal port operation, OC0 disconnected.
0 1 Reserved
1 0 Clear OC0 on Compare Match, set OC0 at BOTTOM,
(non-inverting mode)
1 1 Set OC0 on Compare Match, clear OC0 at BOTTOM,
(inverting mode)
Note:  1. A special case occurs when OCR0 equals TOP and COM01 is set. In this case, the Compare
Match is ignored, but the set or clear is done at BOTTOM. See Fast PWM Mode for more details.
The table below shows the COM01:0 bit functionality when the WGM01:0 bits are set to phase correct
PWM mode.
Table 21-5. Compare Output Mode, Phase Correct PWM Mode
(1)
COM01 COM00 Description
0 0 Normal port operation, OC0 disconnected.
0 1 Reserved
1 0 Clear OC0 on Compare Match when up-counting. Set OC0 on Compare Match when
downcounting.
1 1 Set OC0 on Compare Match when up-counting. Clear OC0 on Compare Match when
downcounting.
Note:  1. A special case occurs when OCR0 equals TOP and COM01 is set. In this case, the Compare
Match is ignored, but the set or clear is done at TOP. See Phase Correct PWM Mode for more details.
Bit 3 – WGM01: Waveform Generation Mode [n=0:1]
Refer to WGM00 above.
Atmel ATmega32A [DATASHEET]
Atmel-8155I-ATmega32A_Datasheet_Complete-08/2016
174