User manual

PSMC Tips
2012-2013 Microchip Technology Inc. DS40001671B-page 39
- Click on the Mode Control function: Click on the tab to set the desired PWM
mode
- Click on the Output Control function: Connect the steering (if needed),
channel polarity, and desired outputs to pins
- Check the PSMC enable box
- Write in the comments section notes about Phase 1 of this 3-phase setup
- Copy this setup using the Copy and Show button
Select PSMC2
- Paste the configuration copied from PSMC1 by clicking on the Paste button
- Click on the Timer function: Change the sync source to PSMC1
- Click on the Modulation function: Disable modulation
- Click on the Output Control function: Change if necessary the steering,
polarity, and channel outputs to pins
- Write in the comments section notes about Phase 2 of this 3-phase setup
- All other settings are the same as PSMC1 and need not be changed
Select PSMC3
- Paste the configuration copied from PSMC1 by clicking on the Paste button
- Click on the Timer function: Change the sync source to PSMC2
- Click on the Output Control function: Change if necessary the steering, polar-
ity, and channel outputs to pins
- Write in the comments section notes about Phase 3 of this 3-phase setup
- All other settings are the same as PSMC2 and need not be changed
Use the file pull-down menu to save the three-phase configuration setup as a C or
Assembly code include file.
If your project initialization routine does not include the I/O pin initialization for the
PSMC outputs, then add that initialization code to your project. Also add the reference
to your project to include the PSMC configuration file.
Modulation has been used in this setup so that the 3-phase output starts in order with
PSMC1 operating first when the modulation source is high. In this example,
Comparator 4 sync output is used as the modulation source. The 3-Phase PWM is
started by Comparator 4 output high and stopped by Comparator 4 output low. This is
accomplished by software setting the C4POL bit to start the PWM and clearing the
C4POL bit to stop the PWM. The C4ON and C4SYNC bits should both be cleared. All
other Comparator 4 control bits are don’t care.
3.3 CENTER WEIGHTED VARIABLE PWM
Some applications benefit from a PWM that spreads from the middle of the period
instead of expanding from the start of the period. This is sometimes referred to as
center weighted PWM. Center weighted PWM can be accomplished by setting the
rising event time to the middle of the period minus half the PWM width and setting the
falling event time to the middle of the period plus half the PWM width (Figure 3-3).
Irregular PWM widths are avoided during the change, because the new settings are
held until the PxLD bit (bit 6 of the PSMCxCON register) is set. The transfer to the
counters is performed synchronous with the PWM period, ensuring that both new
settings take effect in the same period.