This simple example shows how to use the Timer Counter (TC) for generation of pulsed width modulation signals.
The tc driver API can be found here.
All AVR XMEGA devices with tc and awex modules can be used.
The example will configure the Timer E0 (TCE0) in waveform generator mode. AWex is used to output PWM signals from Compare modules CCA and CCB. These complementary signals are output on Port E0 and E1. Deadtimes are inserted. This example is dimming the duty-cycle of the two signals in an opposite way.
In addition the example configures the CCA and CCB interrupts to update the duty-cycle
Summary of Timer Counter configuration:
This example uses the on-board LEDs to provide user feedback, the output from the LEDs are as follows:
This software was written for the GNU GCC and IAR for AVR. Other compilers may or may not work.
For further information, visit Microchip.