Description

This example shows how to configure the Timer Counter in both waveform and capture operating modes. In capture mode, a pulse signal (output from PIN_TC_WAVEFORM) is connected to PIN_TC_CAPTURE, and Register A (RA) and Register B (RB) will be loaded when their programmed event occurs.

When the Timer Counter interrupt occurs, its interrupt handler reads the RA and RB register values (for computing pulse frequency) and also increases the total pulse count number. The current pulse frequency and total pulse count number are both output via the debug UART.

The code can be roughly broken down as follows: