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 2.3 “Pin Descriptions” on page 9. 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 86.
The PRTIM0 bit in Section 6.6 “Power Reduction Register” on page 36 must be written to zero to enable Timer/Counter0
module.
Figure 12-1. 8-bit Timer/Counter Block Diagram
TOVn (Int. Req.)
Count
Clock Select
Clear
Direction
Control Logic
Edge
Detector
Tn
clkTn
(from Prescaler)
TOP
BOTTOM
Timer/Counter
TCNTn
=
= 0
OCnA (Int. Req.)
Waveform
Generation
OCnA
=
OCRnx
Fixed
TOP
Value
OCnB (Int. Req.)
Waveform
Generation
OCnB
=
OCRnx
TCCRnA
TCCRnB
ATmega16/32/64/M1/C1 [DATASHEET]
77
7647O–AVR–01/15