Pulse-Width Modulation (PWM) Module
MCF52110 ColdFire® Integrated Microcontroller Reference Manual, Rev. 1
Freescale Semiconductor
26-19
Preliminary
Figure 26-17. PWM Left-Aligned Output Example Waveform
26.3.2.6
Center-Aligned Outputs
For center-aligned output mode selection, set the PWMCAE[CAE
n
] bit and the corresponding PWM
output is center-aligned.
The 8-bit counter operates as an up/down counter in this mode and is set to up when the counter is equal
to 0x00. The counter compares to two registers, a duty register and a period register, as shown in the block
diagram in
. When the PWM counter matches the duty register, the output flip-flop changes
state, causing the PWM waveform to also change state. A match between the PWM counter and the period
register changes the counter direction from an up-count to a down-count. When the PWM counter
decrements and matches the duty register again, the output flip-flop changes state causing the PWM output
to also change state. When the PWM counter decrements and reaches zero, the counter direction changes
from a down-count back to an up-count, and a load from the double buffer period and duty registers to the
associated registers is performed as described in
. The counter counts from 0 up to the value
in the period register and then back down to 0. Thus the effective period is PWMPER
n
×
2.
Changing the PWM output mode from left-aligned output to center-aligned output (or vice versa) while
channels are operating can cause irregularities in the PWM output. It is recommended to program the
output mode before enabling the PWM channel.
Figure 26-18. PWM Center-Aligned Output Waveform
To calculate the output frequency in center-aligned output mode for a particular channel, take the selected
clock source frequency for the channel (A, B, SA, or SB) and divide it by twice the value in the period
register for that channel.
Eqn. 26-9
The PWM
n
duty cycle (high time as a percentage of period) is expressed as:
PERIOD = 100ns
DUTY CYCLE = 75%
E = 25ns
PPOL
n
= 0
PPOL
n
= 1
Period = PWMPER
n
×
2
PWMDTY
n
PWMPER
n
PWMPER
n
PWMDTY
n
PWM
n
frequency
Clock (A, B, SA, or SB)
2
P
×
WMPER
n
----------------------------------------------------------
=