23.2 Overview

The flexible 16-Bit PWM Timer/Counter type A (TCA) provides accurate program execution timing, frequency and waveform generation, and command execution.

A TCA consists of a base counter and a set of compare channels. The base counter can be used to count clock cycles or events or let events control how it counts clock cycles. It has direction control and can use a period setting for timing. The compare channels can be used with the base counter to perform a compare match control, frequency generation, and pulse-width waveform modulation.

Depending on the mode of operation, the counter is cleared, reloaded, incremented, or decremented at each timer/counter clock or event input.

A timer/counter can be clocked and timed from the peripheral clock, with optional prescaling, or from the Event System. The Event System can also be used for direction control or synchronizing operations.

By default, the TCA is a 16-bit timer/counter. The timer/counter has a Split mode feature that splits it into two 8-bit timer/counters with three compare channels each. Depending on the used mode, addressing registers or using bit masks and group configurations is done as follows: Either TCAn.SINGLE.REGISTER or TCAn.SPLIT.REGISTER for the registers and TCA_SINGLE_CLKSEL_DIV1_gc or TCA_SPLIT_CLKSEL_DIV1_gc as an example for the bit masks and group configurations.

In this section the registers will be addressed as TCAn.REGISTER.

The figure below shows a block diagram of the 16-bit timer/counter with closely related peripheral modules (in gray).

Figure 23-1. 16-Bit Timer/Counter and Closely Related Peripherals