Overview
Timer/Counter Overview
The flexible 16-bit TCE provides an accurate program execution timing, frequency and waveform generation, and command execution.
A TCE instance consists of a base counter and four compare channels. Based on the clock ticks (timer) or different events (counter), the base counter can be set by the user to count upwards or downwards. A timer/counter can be clocked and timed from the peripheral clock, with optional prescaling, or from the EVSYS. The EVSYS can also be used for direction control or to synchronize operations.
The counter includes a high-resolution option that can increase the duty cycle resolution up to eight times of the input clock. Additionally, a prescaled peripheral clock and events from the EVSYS can be used to control the counter.
The counter value is continuously compared to zero and the period (PER) value to determine when the counter has reached BOTTOM or TOP, respectively. If one of the conditions is met, the counter is updated, and an interrupt is generated. The counter is also compared with the Compare registers. The counter uses these comparisons to generate interrupts and set the waveform and period of the pulse-width, if a Waveform Generation mode is selected.
The Counter, Period, and Compare registers and all their buffers are 16-bits wide. The buffers are part of a scheme that ensures the respective registers are updated only when the Counter register is updated. Each buffer has a Buffer Valid (BV) bit used to determine if the respective register requires updates.
The TCE can be configured to use the EVSYS to count the rising and/or falling edges of the event signal or use it to enable clock ticks counting.
TCE offers the option of writing a fractional value between 0 and 2 to the compare registers, if the SCALEMODE option is enabled. The compare value is calculated based on the period, amplitude, and offset values.
Waveform Extension Overview
The WEX provides extra functions to the timer/counter in Waveform Generation (WG) modes, such as complementary signal generation with dead time. This functions are helpful for motor control and power control applications.
- Input matrix
- Dead time insertion unit
- Swap unit
- Pattern generation unit
- Fault protection unit