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