23.3.4.3 Changing the Period
The Counter period is changed by writing a new TOP value to the Period (TCEn.PER) register.
Changing the Period Without Buffering
When not using Double Buffering, any period update is immediate.
A counter wraparound can occur in any
mode of operation when up-counting without buffering. This happens because the TCEn.CNT
and TCEn.PER registers are continuously compared. If a new TOP value is written to
TCEn.PER that is lower than current TCEn.CNT, the counter will wrap first before a
compare match happens.
Changing the Period Using Buffering
When using Double Buffering, the buffer
can be written at any time and maintain the correct operation. The TCEn.PER is always
updated on the UPDATE condition, as shown for dual-slope operation in
the figure below, preventing wrap-around and the generation of odd waveforms.