32.3.2 Initialization

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

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

  3. The counter value can be read from the Counter (TCBn.CNT) register. The peripheral will generate a CAPT interrupt and event when the CNT value reaches TOP.
    1. If the Compare/Capture register is modified to a value lower than the current CNT, the peripheral will count to MAX and wrap around.
    2. At MAX, an OVF interrupt and event will be generated.