dsPIC30F Family Reference Manual
DS70062C-page 15-20 © 2004 Microchip Technology Inc.
15.4 PWM Duty Cycle Comparison Units
The MCPWM module has four PWM generators. There are four 16-bit special function registers
used to specify duty cycle values for the PWM generators:
• PDC1
• PDC2
• PDC3
• PDC4
In subsequent discussions, PDCx refers to any of the four PWM duty cycle registers.
15.4.1 PWM Duty Cycle Resolution
The maximum resolution (in bits) for a given device oscillator and PWM frequency can be
determined from the following formula:
Equation 15-2: PWM Resolution
The PWM resolutions and frequencies are shown in Table 15-2 for a selection of execution
speeds and PTPER values. The PWM frequencies in Table 15-2 are for edge-aligned (Free
Running PTMR) PWM mode. For center aligned modes (Up/Down PTMR mode), the PWM
frequencies will be 1/2 the values indicated in Table 15-2.
Table 15-2: Example PWM Frequencies and Resolutions, 1:1 Prescaler
The MCPWM module has the ability to produce PWM signal edges with T
CY/2 resolution. PTMR
increments every T
CY with a 1:1 prescaler. To achieve TCY/2 edge resolution, PDCx<15:1> is
compared to PTMR<14:0> to determine a duty cycle match. PDCx<0> determines whether the
PWM signal edge will occur at the T
CY or the TCY/2 boundary. When a 1:4, 1:16 or a 1:64
prescaler is used with the PWM time base, PDCx<0> is compared to the MSbit of the prescaler
counter clock to determine when the PWM edge should occur.
Resolution
2T
PWM
TCY
------------------
log
2()log
--------------------------------=
TCY (FCY) PTPER Value PWM Resolution PWM Frequency
33 ns (30 MHz) 0x7FFF 16 bits 915 Hz
33 ns (30 MHz) 0x3FF 11 bits 29.3 KHz
50 ns (20 MHz) 0x7FFF 16 bits 610 Hz
50 ns (20 MHz) 0x1FF 10 bits 39.1 KHz
100 ns (10 MHz) 0x7FFF 16 bits 305 Hz
100 ns (10 MHz) 0xFF 9 bits 39.1 KHz
200 ns (5 MHz) 0x7FFF 16 bits 153 Hz
200 ns (5 MHz) 0x7F 8 bits 39.1 KHz
Note: PWM frequencies will be 1/2 the value indicated for center aligned operation.
Note: The MCPWM can produce PWM signals with TCY/2 edge resolution.