
356
42073A-MCU Wireless-02/13
ATmega2564/1284/644RFR2
Register Bits
Value
Description
3
Set OC2A on Compare Match
Bit 5:4 – COM2B1:0 - Compare Match Output B Mode
These bits control the Output Compare pin (OC2B) behavior. If one or both of the
COM2B1:0 bits are set, the OC2B output overrides the normal port functionality of the
I/O pin it is connected to. However, note that the Data Direction Register (DDR) bit
corresponding to the OC2B pin must be set in order to enable the output driver. When
OC2B is connected to the pin, the function of the COM2B1:0 bits depends on the
WGM22:20 bit settings. The following table shows the COM2B1:0 bit functionality when
the WGM22:20 bits are set to a normal or CTC mode (non-PWM). Refer to section
"Compare Match Output Unit" for a description of the functionality in the other modes.
Table 21-8 COM2B Register Bits
Register Bits
Value
Description
COM2B1:0
0
Normal port operation, OC2B disconnected
1
Toggle OC2B on Compare Match
2
Clear OC2B on Compare Match
3
Set OC2B on Compare Match
Bit 3:2 – Res1:0 - Reserved
Bit 1:0 – WGM21:20 - Waveform Generation Mode
Combined with the WGM22 bit found in the TCCR2B Register, these bits control the
counting sequence of the counter, the source for maximum (TOP) counter value, and
what type of waveform generation to be used. Modes of operation supported by the
Timer/Counter2 unit are: Normal mode (counter), Clear Timer on Compare Match
(CTC) mode, and two types of Pulse Width Modulation (PWM) modes (see section
"Modes of Operation" for details).
Table 21-9 WGM2 Register Bits
Register Bits
Value
Description
WGM22:20
0x0
Normal mode of operation
0x1
PWM, phase correct, TOP=0xFF
0x2
CTC, TOP = OCRA
0x3
Fast PWM, TOP=0xFF
0x4
Reserved
0x5
PWM, Phase correct, TOP = OCRA
0x6
Reserved
0x7
Fast PWM, TOP=OCRA
21.11.4 TCCR2B – Timer/Counter2 Control Register B
Bit
7
6
5
4
3
2
1
0
NA ($B1)
FOC2A
FOC2B
Res1
Res0
WGM22
CS22
CS21
CS20
TCCR2B
Read/Write
RW
Initial Value
0
Bit 7 – FOC2A - Force Output Compare A