4 Generate Eight PWM Signals with TCE and WEX
The TCE can be used to generate precise and versatile PWM signals on it's four channels and also generate complementary waveforms that do no overlap.
The WEX can be configured to extend the four compare channels given by TCE up to eight channels that can generate a PWM signal.
Below is an example of how to set a TCE and a WEX instance to generate eight complementary PWM signals at 20 kHz with variable duty cycles using the buffering, use Section 3 for reference. The signals are in pair of two and are not overlapping due to the added dead-time, a feature which is essential in motor control for avoiding the shoot-through current in transistor switching. The update of the compare registers will happen during the compare match interrupts for each channel. In this example the fault protection feature is highlighted as well. When a software event is triggered it emulates a fault and all the signals are driven low. This happens every 1 ms. To do this the WEX must be configured for fault detection and the EVSYS must be configured to generate a software event.
The following two subsections will explain in detail how to configure the TCE and WEX peripherals to do the desired behavior. The first subsection explains how to configure TCE and WEX using bare metal code. The second subsection explains how to configure TCE and WEX using MCC Melody. The last subsection contains the results.