Datasheet
125
ATmega48PA/88PA/168PA [DATASHEET]
9223F–AVR–04/14
18. 8-bit Timer/Counter2 with PWM and Asynchronous Operation
18.1 Features
● Single channel counter
● Clear timer on compare match (auto reload)
● Glitch-free, phase correct pulse width modulator (PWM)
● Frequency generator
● 10-bit Clock prescaler
● Overflow and compare match interrupt sources (TOV2, OCF2A and OCF2B)
● Allows clocking from external 32kHz watch crystal independent of the I/O clock
18.2 Overview
Timer/Counter2 is a general purpose, single channel, 8-bit Timer/Counter module. A simplified block diagram of the 8-bit
Timer/Counter is shown in Figure 18-1. For the actual placement of I/O pins, refer to
Section 1-1 “Pinout Atmel ATmega48PA/88PA/168PA” on page 3. CPU accessible I/O registers, including I/O bits and I/O
pins, are shown in bold. The device-specific I/O register and bit locations are listed in the
Section 18.11 “Register Description” on page 137.
The PRTIM2 bit in Section 10.10 “Minimizing Power Consumption” on page 37 must be written to zero to enable
Timer/Counter2 module.
Figure 18-1. 8-bit Timer/Counter Block Diagram
Control Logic
TCNTn
Timer/Counter
Count
Clear
Direction
clk
Tn
OCRnA
OCRnB
TCCRnA TCCRnB
=
Edge
Detector
(from Prescaler)
Clock Select
TOP BOTTOM
TOVn (Int. Req.)
OCnA (Int. Req.)
Tn
Waveform
Generation
Fixed
TOP
Value
DATA BUS
=
= = 0
OCnA
OCnB (Int. Req.)
Waveform
Generation
OCnB