Datasheet
81
ATmega48PA/88PA/168PA [DATASHEET]
9223F–AVR–04/14
15. 8-bit Timer/Counter0 with PWM
15.1 Features
● Two independent output compare units
● Double buffered output compare registers
● Clear timer on compare match (auto reload)
● Glitch free, phase correct pulse width modulator (PWM)
● Variable PWM period
● Frequency generator
● Three independent interrupt sources (TOV0, OCF0A, and OCF0B)
15.2 Overview
Timer/Counter0 is a general purpose 8-bit Timer/Counter module, with two independent output compare Units, and with
PWM support. It allows accurate program execution timing (event management) and wave generation.
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 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 Section 15.9 “Register Description” on
page 91. The PRTIM0 bit in Section 10.10 “Minimizing Power Consumption” on page 37 must be written to zero to enable
Timer/Counter0 module.
Figure 15-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