Datasheet

77
ATmega48/88/168 Automotive [DATASHEET]
7530K–AVR–07/14
12. 8-bit Timer/Counter0 with PWM
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. The main features
are:
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)
12.1 Overview
A simplified block diagram of the 8-bit Timer/Counter is shown in Figure 12-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 12.8 “8-bit Timer/Counter Register Description”
on page 87.
The PRTIM0 bit in Section 7.7.1 “Power Reduction Register - PRR” on page 35 must be written to zero to enable
Timer/Counter0 module.
Figure 12-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