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 (TCB.CCMP).
  • Enable the counter by writing a '1' to the ENABLE bit in the Control A register (TCB.CTRLA).

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

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