99
7679H–CAN–08/08
AT90CAN32/64/128
12. 8-bit Timer/Counter0 with PWM
Timer/Counter0 is a general purpose, single channel, 8-bit Timer/Counter module. The main
features are:
12.1 Features
• Single Channel Counter
• Clear Timer on Compare Match (Auto Reload)
• Glitch-free, Phase Correct Pulse Width Modulator (PWM)
• Frequency Generator
• External Event Counter
• 10-bit Clock Prescaler
• Overflow and Compare Match Interrupt Sources (TOV0 and OCF0A)
12.2 Overview
Many register and bit references in this section are written in general form.
• A lower case “n” replaces the Timer/Counter number, in this case 0. However, when using
the register or bit defines in a program, the precise form must be used, i.e., TCNT0 for
accessing Timer/Counter0 counter value and so on.
• A lower case “x” replaces the Output Compare unit channel, in this case A. However, when
using the register or bit defines in a program, the precise form must be used, i.e., OCR0A for
accessing Timer/Counter0 output compare channel A value and so on.
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 “Pin Configurations” on page 5. 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 loca-
tions are listed in the “8-bit Timer/Counter Register Description” on page 109.
Figure 12-1. 8-bit Timer/Counter Block Diagram
Timer/Counter
DATA BUS
=
TCNTn
Waveform
Generation
OCnx
= 0
Control Logic
=
0xFF
BOTTOM
count
clear
direction
TOVn
(Int.Req.)
OCRnx
TCCRn
Clock Select
Tn
Edge
Detector
( From Prescaler )
clk
Tn
TOP
OCn
(Int.Req.)