20.3.3.3 Changing the Period

The Counter period is changed by writing a new TOP value to the Period register (TCAn.PER).

No Buffering: If double buffering is not used, any period update is immediate.

Figure 20-6. Changing the Period Without Buffering
A counter wrap-around can occur in any mode of operation when up-counting without buffering. This is due to the fact that the TCAn.CNT and TCAn.PER registers are continuously compared: if a new TOP value is written to TCAn.PER that is lower than the current TCAn.CNT, the counter will wrap first, before a compare match happens.
Figure 20-7. Unbuffered Dual-Slope Operation
With Buffering: When double buffering is used, the buffer can be written at any time and still maintain correct operation. The TCAn.PER is always updated on the UPDATE condition, as shown for dual-slope operation in the figure below. This prevents wrap-around and the generation of odd waveforms.
Figure 20-8. Changing the Period Using Buffering