174
8331B–AVR–03/12
Atmel AVR XMEGA AU
Figure 14-7.
Changing the period without buffering.
A counter wraparound can occur in any mode of operation when up-counting without buffering,
as shown in
. This due to the fact that CNT and PER are continuously compared,
and if a new TOP value that is lower than current CNT is written to PER, it will wrap before a
compare match happen.
Figure 14-8.
Unbuffered dual-slope operation.
When double buffering is used, the buffer can be written at any time and still maintain correct
operation. The period register is always updated on the UPDATE condition, as shown for dual-
slope operation in
. This prevents wraparound and the generation of odd waveforms.
Figure 14-9.
Changing the period using buffering.
CNT
MAX
New TOP written to
PER that is higher
than current CNT
Counter Wraparound
New TOP written to
PER that is lower
than current CNT
"update"
"write"
BOTTOM
CNT
MAX
New TOP written to
PER that is higher
than current CNT
New TOP written to
PER that is lower
than current CNT
"update"
"write"
Counter Wraparound
BOTTOM
CNT
MAX
New Period written to
PERBUF that is higher
than current CNT
New Period written to
PERBUF that is lower
than current CNT
"update"
"write"
New PER is updated
with PERBUF value.
BOTTOM