23.3.4.2 Double Buffering

The Period (TCEn.PER) and the Compare n (TCEn.CMPn) registers are all double-buffered (TCEn.PERBUF and TCEn.CMPnBUF).

Each buffer register has a Buffer Valid (BV) flag (PERBV, CMPnBV) in the Control F (TCEn.CTRLF) register, which indicates that the buffer register contains a valid (new) value that can be copied into the corresponding Period or Compare register. When using the TCEn.PER and TCEn.CMPn registers for a compare operation, the BV flag is automatically set when data are written to the buffer register and cleared on an UPDATE condition. The figure below shows the steps when writing to the Compare (CMPn) register using Double Buffering.

Figure 23-4. Compare Double Buffering

The TCEn.CMPn and TCEn.CMPnBUF registers are available as I/O registers, allowing the initialization and bypassing of the buffer register and the double-buffering function.