20.3.3.3 Changing the Period

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

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 counting up without buffering, as 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 occurs.
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 the 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
Note: Buffering is used in figures illustrating TCA operation if not otherwise specified.