
151
ATmega64A [DATASHEET]
8160D–AVR–02/2013
Table 18-4 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
Table 18-5 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
Bit 2:0 – CS22:0: Clock Select
The three Clock Select bits select the clock source to be used by the Timer/Counter.
If external pin modes are used for the Timer/Counter2, transitions on the T2 pin will clock the counter even if the
pin is configured as an output. This feature allows software control of the counting.
18.9.2
TCNT2 – Timer/Counter Register
The Timer/Counter Register gives direct access, both for read and write operations, to the Timer/Counter unit 8-bit
counter. Writing to the TCNT2 Register blocks (removes) the Compare Match on the following timer clock. Modify-
Table 18-4.
Compare Output Mode, Fast PWM Mode
COM21
COM20
Description
0
Normal port operation, OC2 disconnected.
01
Reserved
1
0
Clear OC2 on Compare Match, set OC2 at BOTTOM, (non-inverting mode).
1
Set OC2 on Compare Match, clear OC2 at BOTTOM, (inverting mode).
Table 18-5.
Compare Output Mode, Phase Correct PWM Mod
eCOM21
COM20
Description
0
Normal port operation, OC2 disconnected.
01
Reserved
1
0
Clear OC2 on Compare Match when up-counting. Set OC2 on Compare Match when downcounting.
1
Set OC2 on Compare Match when up-counting. Clear OC2 on Compare Match when downcounting.
Table 18-6.
Clock Select Bit Description
CS22
CS21
CS20
Description
0
No clock source (Timer/counter stopped).
00
1
clkI/O/(No prescaling)
01
0
clkI/O/8 (From prescaler)
01
1
clkI/O/64 (From prescaler)
10
0
clkI/O/256 (From prescaler)
10
1
clkI/O/1024 (From prescaler)
1
0
External clock source on T2 pin. Clock on falling edge.
1
External clock source on T2 pin. Clock on rising edge.
Bit
7654
3210
TCNT2[7:0]
TCNT2
Read/Write
R/W
Initial Value
0000