25.3.2 Initialization

To start using the timer/counter in the Frequency Generation mode, follow these steps:

  • Write a TOP value to the Compare (TCFn.CMP) register. Enable the peripheral by writing a ‘1’ to the Enable (ENABLE) bit in the Control A (TCFn.CTRLA) register.
  • The counter will start counting clock ticks according to the prescaler setting in the Clock Select (CLKSEL) bit field in TCFn.CTRLA)
  • The counter value can be read from the Count (TCFn.CNT) register. The TCF will generate an interrupt when the CNT value reaches TOP if the interrupts are enabled.