Introduction
Author: Catalin Visan, Microchip Technology Inc. |
The AVR® microcontrollers are equipped with powerful timers designed to cover a wide area of applications, from signal measurement to events synchronization and waveform generation.
The Timer/Counter type D (TCD) is a 12-bit timer available in tinyAVR® 1-series and AVR DA devices. The TCD is designed to cover the need for a fast timer with multiple waveform generation capabilities in common embedded applications, such as motor control or Switch mode power supplies. One of the key features of the TCD is that in addition to running from the main clock, it can be set up to run directly from the internal 20 MHz oscillator (OSC20M) or used with an external clock source. Moreover, it has multiple configurable Waveform Generation modes.
- Generating complementary driving signals:
Initialize the timer to generate two complementary signals with 50 kHz frequency and 100 ns dead-time.
- Controlling synchronous signals using input
events:
Initialize the timer to generate four PWM signals with 10 kHz frequency and approximately 50% duty cycle, synchronized in pairs. Configure an input channel for fault detection purposes.