21.3.2 Initialization

By default, the TCB is in Periodic Interrupt mode. Follow these steps to start using it:
  • Write a TOP value to the Compare/Capture register (TCBn.CCMP).
  • Enable the counter by writing a '1' to the ENABLE bit in the Control A register (TCBn.CTRLA).

    The counter will start counting clock ticks according to the prescaler setting in the Clock Select bit field (CLKSEL in TCBn.CTRLA).

  • The counter value can be read from the Count register (TCBn.CNT). The peripheral will generate an interrupt when the CNT value reaches TOP.