Datasheet
119
ATmega48/88/168 Automotive [DATASHEET]
7530K–AVR–07/14
15. 8-bit Timer/Counter2 with PWM and Asynchronous Operation
Timer/Counter2 is a general purpose, single channel, 8-bit Timer/Counter module. The main features are:
● 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
15.1 Overview
A simplified block diagram of the 8-bit Timer/Counter is shown in Figure 15-1. For the actual placement of I/O pins, refer to
Section 1-1 “Pinout ATmega48/88/168” 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 Section 15.8 “8-bit Timer/Counter Register Description”
on page 129.
The PRTIM2 bit in Section 7.7.1 “Power Reduction Register - PRR” on page 35 must be written to zero to enable
Timer/Counter2 module.
Figure 15-1. 8-bit Timer/Counter Block Diagram
TCNTn
Timer/Counter
Count
Clear
Direction
OCRnA
OCRnB
TCCRnA TCCRnB
=
TOP BOTTOM
OCnA (Int. Req.)
Waveform
Generation
Fixed
TOP
Value
DATA BUS
=
= = 0
OCnA
OCnB (Int. Req.)
Waveform
Generation
OCnB
Control Logic
clk
Tn
clk
I/O
Prescaler
TOVn (Int. Req.)
T/C
Oscillator
TOSC1
TOSC2