beautypg.com

Atmega128rfa1 – Rainbow Electronics ATmega128RFA1 User Manual

Page 231

background image

231


8266A-MCU Wireless-12/09

ATmega128RFA1

A state change of the COM0x1:0 bits 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 FOC0x strobe bits.

The following table shows the COM0x1:0 bit functionality when the WGM02:0 bits are
set to a normal or CTC mode (non-PWM).

Table 17-2. Compare Output Mode, non-PWM Mode

COM0A1
COM0B1

COM0A0
COM0B0

Description

0

0

Normal port operation, OC0x disconnected;

0

1

Toggle OC0x on Compare Match;

1

0

Clear OC0x on Compare Match;

1

1

Set OC0x on Compare Match;

Table 17-3 shows the COM0x1:0 bit functionality when the WGM01:0 bits are set to fast
PWM mode.

Table 17-3. Compare Output Mode, Fast PWM Mode

COM0A1
COM0B1

COM0A0
COM0B0

Description

0

0

Normal port operation, OC0x disconnected.

0

1

WGM02 = 0: Normal Port Operation, OC0A Disconnected.
WGM02 = 1: Toggle OC0A on Compare Match.
OC0B: not applicable, reserved function;

1

0

Clear OC0x on Compare Match, set OC0x at BOTTOM, (non-
inverting mode).

1

1

Set OC0x on Compare Match, clear OC0x at BOTTOM, (inverting
mode).

Note:

A special case occurs when OCR0x equals TOP and COM0x1 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 233

.

Table 17-4 shows the COM0x1:0 bit functionality when the WGM02:0 bits are set to
phase correct PWM mode.

Table 17-4. Compare Output Mode, Phase Correct PWM Mode

COM0A1
COM0B1

COM0A0
COM0B0

Description

0

0

Normal port operation, OC0x disconnected.

0

1

WGM02 = 0: Normal Port Operation, OC0A Disconnected.
WGM02 = 1: Toggle OC0A on Compare Match.
OC0B: not applicable, reserved function;

1

0

Clear OC0x on Compare Match when up-counting. Set OC0x on
Compare Match when down-counting.

1

1

Set OC0x on Compare Match when up-counting. Clear OC0x on
Compare Match when down-counting.

Note:

A special case occurs when OCR0x equals TOP and COM0x1 is set. In this case, the
Compare Match is ignored, but the set or clear is done at TOP. See

"Fast PWM

Mode" on page 233

for more details.