Changing the Period

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

No Buffering:Any period update is immediate if not using double-buffering.

Figure 1. 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 writing a new TOP value to TCAn.PER lower than the current TCAn.CNT, the counter will wrap first before a compare match occurs.
Figure 2. Unbuffered Dual-Slope Operation
With Buffering: When using double-buffering, the buffer can be written at any time and still maintain the correct operation. 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 3. Changing the Period Using Buffering
Note: Buffering is used in figures illustrating TCA operation if not otherwise specified.