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