Datasheet
OCnxPCPWM
=
clk_I/O
510
N represents the prescaler factor (1, 8, 64, 256, or 1024).
The extreme values for the OCR0A register represent special cases when generating a PWM waveform
output in the Phase Correct PWM mode: If the OCR0A register is written equal to BOTTOM, the output
will be continuously low. If OCR0A is written to MAX, the output will be continuously high for non-inverted
PWM mode. For inverted PWM the output will have the opposite logic values.
At the very start of period 2 in the timing diagram above, OC0x has a transition from high to low even
though there is no compare match. This transition serves to guarantee symmetry around BOTTOM.
There are two cases that give a transition without Compare Match:
• OCR0x changes its value from MAX, as in the timing diagram. When the OCR0A value is MAX, the
OC0 pin value is the same as the result of a down-counting compare match. To ensure symmetry
around BOTTOM the OC0x value at MAX must correspond to the result of an up-counting compare
match.
• The timer starts up-counting from a value higher than the one in OCR0x, and for that reason
misses the compare match and consequently, the OC0x does not undergo the change that would
have happened on the way up.
19.8 Timer/Counter Timing Diagrams
The timer/counter is a synchronous design and the timer clock (clk
T0
) is therefore shown as a clock
enable signal in the following figures. If the given instance of the TC0 supports an Asynchronous mode,
clk
I/O
should be replaced by the TC oscillator clock.
The figures include information on when interrupt flags are set. The first figure below illustrates timing
data for basic timer/counter operation close to the MAX value in all modes other than phase correct PWM
mode.
Figure 19-8. Timer/Counter Timing Diagram, no Prescaling
clk
Tn
(clk
I/O
/1)
TOVn
clk
I/O
TCNTn MAX - 1 MAX BOTTOM BOTTOM + 1
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 next figure shows the same timing data, but with the prescaler enabled.
ATmega48PA/88PA/168PA
8-bit Timer/Counter0 (TC0) with PWM
© 2018 Microchip Technology Inc.
Datasheet Complete
DS40002011A-page 147