ATmega88PA Automotive Atmel Corporation, ATmega88PA Automotive Datasheet - Page 146

no-image

ATmega88PA Automotive

Manufacturer Part Number
ATmega88PA Automotive
Description
Manufacturer
Atmel Corporation
18.5
Output Compare Unit
The 8-bit comparator continuously compares TCNT2 with the Output Compare Register
(OCR2A and OCR2B). Whenever TCNT2 equals OCR2A or OCR2B, the comparator signals a
match. A match will set the Output Compare Flag (OCF2A or OCF2B) at the next timer clock
cycle. If the corresponding interrupt is enabled, the Output Compare Flag generates an Output
Compare interrupt. The Output Compare Flag is automatically cleared when the interrupt is
executed. Alternatively, the Output Compare Flag can be cleared by software by writing a log-
ical one to its I/O bit location. The Waveform Generator uses the match signal to generate an
output according to operating mode set by the WGM22:0 bits and Compare Output mode
(COM2x1:0) bits. The max and bottom signals are used by the Waveform Generator for han-
dling the special cases of the extreme values in some modes of operation
(“Modes of
Operation” on page
149).
Figure 18-3
shows a block diagram of the Output Compare unit.
Figure 18-3. Output Compare Unit, Block Diagram
DATA BUS
OCRnx
TCNTn
=
(8-bit Comparator )
OCFnx (Int.Req.)
top
bottom
Waveform Generator
OCnx
FOCn
WGMn1:0
COMnX1:0
The OCR2x Register is double buffered when using any of the Pulse Width Modulation (PWM)
modes. For the Normal and Clear Timer on Compare (CTC) modes of operation, the double
buffering is disabled. The double buffering synchronizes the update of the OCR2x Compare
Register to either top or bottom of the counting sequence. The synchronization prevents the
occurrence of odd-length, non-symmetrical PWM pulses, thereby making the output
glitch-free.
The OCR2x Register access may seem complex, but this is not case. When the double buffer-
ing is enabled, the CPU has access to the OCR2x Buffer Register, and if double buffering is
disabled the CPU will access the OCR2x directly.
Atmel ATmega48PA/88PA/168PA [Preliminary]
146
9223B–AVR–09/11

Related parts for ATmega88PA Automotive