Datasheet

according to operating mode set by the WGM02, WGM01, and WGM00 bits and Compare Output mode
(COM0x[1:0]) bits. The maximum and bottom signals are used by the waveform generator for handling
the special cases of the extreme values in some modes of operation.
Figure 19-3. Output Compare Unit, Block Diagram
OCFnx (Int.Req.)
=(8-bit Comparator )
OCRnx
OCnx
DATA BUS
TCNTn
WGMn[1:0]
Waveform Generator
top
FOCn
COMnx[1:0]
bottom
Note:  The “n” in the register and bit names indicates the device number (n = 0 for Timer/Counter 0), and
the “x” indicates output compare unit (A/B).
The OCR0x registers are double buffered when using any of the Pulse Width Modulation (PWM) modes.
When double buffering is enabled, the CPU has access to the OCR0x Buffer register. The double
buffering synchronizes the update of the OCR0x Compare registers 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 double buffering is disabled for the normal and Clear Timer on Compare (CTC) modes of operation,
and the CPU will access the OCR0x directly.
19.5.1 Force Output Compare
In non-PWM Waveform Generation modes, the match output of the comparator can be forced by writing a
'1' to the Force Output Compare (TCCR0C.FOCnx) bit. Forcing compare match will not set the OCFnx
flag or reload/clear the timer, but the OCnx pin will be updated as if a real compare match had occurred
(the TCCRnA.COMnx[1:0] bits define whether the OCnx pin is set, cleared or toggled).
19.5.2 Compare Match Blocking by TCNTn Write
All CPU write operations to the TCNTn register will block any compare match that occurs in the next timer
clock cycle, even when the timer is stopped. This feature allows OCRnx to be initialized to the same
value as TCNTn without triggering an interrupt when the timer/counter clock is enabled.
ATmega48PA/88PA/168PA
8-bit Timer/Counter0 (TC0) with PWM
© 2018 Microchip Technology Inc.
Datasheet Complete
DS40002011A-page 140