Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

© 2010 Microchip Technology Inc. Preliminary DS39735A-page 47-35
Section 47. Motor Control PWM
Motor Control
PWM
47
Table 47-4 shows an example of the dead-time ranges as a function of the selected input clock
prescaler and the device operating frequency.
Table 47-4: Example Dead-Time Ranges
47.12.3 Dead-Time Distortion
For short PWM duty cycles, the ratio of dead time to the active PWM time can become large. In
an extreme case, when the duty cycle is less than or equal to the programmed duty cycle, no
PWM pulse will be generated. In these cases, the inserted dead time introduces distortion into
waveforms produced by the PWM module.
The user application can minimize dead-time distortion by keeping the PWM duty cycle at least
three times larger than the dead time. Dead-time distortion can also be corrected by other
techniques, such as closed loop current control.
A similar effect occurs for duty cycles near 100%. The maximum duty cycle used in the
application should be chosen such that the minimum inactive time of the PWM signal is at least
three times larger than the dead time.
The following code examples demonstrate how to configure the MCPWM module.
Example 47-1: MCPWM Module Operating Mode and Time Selection
Example 47-2: MCPWM Module Output Mode Selection
T
CY (FCY) Prescaler Selection Resolution Dead-Time Range
62.5 ns (16 MHz) 1 T
CY 62.5 ns 62.5 ns-4 µs
62.5 ns (16 MHz) 4 T
CY 250 ns 250 ns-16 µs
125 ns (8 MHz) 1 T
CY 125 ns 125 ns-8 µs
125 ns (8 MHz) 2 TCY 250 ns 250 ns-16 µs
250 ns (4 MHz) 1 TCY 250 ns 250 ns-16 µs
/* PWM time base operates in a Free Running mode */
P1TCONbits.PTMOD = 0b00;
/* PWM time base input clock period is T
CY (1:1 prescale) */
/* PWM time base output post scale is 1:1 */
P1TCONbits.PTCKPS = 0b00;
P1TCONbits.PTOPS = 0b00;
/* Choose PWM time period based on input clock selected */
/* Refer to Equation 47-1 */
/* PWM switching frequency is 20 kHz */
/* F
CY is 16 MHz */
P1TPER = 799;
/* PWM I/O pairs 1 to 3 are in complementary mode */
/* PWM pins are enabled for PWM output */
PWM1CON1bits.PMOD1 = 0;
PWM1CON1bits.PMOD2 = 0;
PWM1CON1bits.PMOD3 = 0;
PWM1CON1bits.PEN1H = 1;
PWM1CON1bits.PEN2H = 1;
PWM1CON1bits.PEN3H = 1;
PWM1CON1bits.PEN1L = 1;
PWM1CON1bits.PEN2L = 1;
PWM1CON1bits.PEN3L = 1;
/* Immediate update of PWM enabled */
PWM1CON2bits.IUE = 1;

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh