23.3.2 Initialization
To initialize the TCD:
- Select the clock source and the prescaler from the Control A (TCDn.CTRLA) register.
- Select the Waveform Generation mode from the Control B (TCDn.CTRLB) register.
- Optional: Configure the other static registers to the desired functionality.
- Write the initial values in the Compare (TCDn.CMPxSET/CLR) registers.
- Optional: Write the desired values to the other double-buffered registers.
- Ensure that the Enable Ready (ENRDY) bit in the Status (TCDn.STATUS) register is set
to ‘
1
’. - Enable the TCD by writing a ‘
1
’ to the ENABLE bit in the Control A (TCDn.CTRLA) register.