2.5.2 TCB - Timer/Counter Type B
The Timer/Counter type B (TCB) of the AVR Dx devices can be used to replace all the functionalities of Timer 1 from the megaAVR devices.
The capabilities of the TCB include frequency and waveform generation and input capture on an event with time and frequency measurement of the digital signals. The TCB consists of a base counter and control logic that can be set in one of eight different modes, each mode providing unique functionality.
If the waveform output (WO) is required to be available on a pin, the Compare/Capture
Output Enable (CCMPEN) from the Control B (TCBn.CTRLB) register must be written to
‘1
’. The location of WO is also selectable using the
PORTMUX.TCBROUTEA register, but the direction of the WO pin needs to be configured as an
output (the TCB overwrites the functionality of the output pin but does not overwrite
the pin direction).
The following code snippets show the TCB initialization examples for a few use cases.