Atmega32(l) – Rainbow Electronics ATmega32L User Manual

Page 79

Advertising
background image

79

ATmega32(L)

2503C–AVR–10/02

When OC0 is connected to the pin, the function of the COM01:0 bits depends on the
WGM01:0 bit setting. Table 39 shows the COM01:0 bit functionality when the WGM01:0
bits are set to a normal or CTC mode (non-PWM).

Table 40 shows the COM01:0 bit functionality when the WGM01:0 bits are set to fast
PWM 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 TOP. See “Fast PWM Mode”
on page 73 for more details.

Table 41 shows the COM01:0 bit functionality when the WGM01:0 bits are set to phase
correct PWM 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 TOP. See “Phase Correct
PWM Mode” on page 74 for more details.

• Bit 2:0 – CS02:0: Clock Select

The three Clock Select bits select the clock source to be used by the Timer/Counter.

Table 39. 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

Table 40. 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 TOP

1

1

Set OC0 on compare match, clear OC0 at TOP

Table 41. 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.

Table 42. Clock Select Bit Description

CS02

CS01

CS00

Description

0

0

0

No clock source (Timer/Counter stopped).

0

0

1

clk

I/O

/(No prescaling)

0

1

0

clk

I/O

/8 (From prescaler)

Advertising