Pulse-Width Modulation (PWM) Module
MCF52211 ColdFire® Integrated Microcontroller Reference Manual, Rev. 2
27-18 Freescale Semiconductor

27.3.2.5 Left-Aligned Outputs

The PWM timer provides the choice of two types of outputs: left- or center-aligned. They are selected with
the PWMCAE[CAEn] bits. If the CAEn bit is cleared, the corresponding PWM output is left-aligned.
In left-aligned output mode, the 8-bit counter is configured as an up counter only. It compares to two
registers, a duty register and a period register, as shown in the block diagram in Figure 27-15. 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 resets the counter and the
output flip-flop, as shown in Figure 27-16, as well as performing a load from the double buf fer period and
duty register to the associated registers, as described in Figure 27.3.2.3. The counter counts from 0 to the
value in the period register minus 1.
NOTE
Changing the PWM output mode from left-aligned 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 27-16. PWM Left-Aligned Output Waveform
To calculate the output frequency in left-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 the value in the period register
for that channel.
Eqn. 27-7
The PWMn duty cycle (high time as a percentage of period) is expressed as:
Eqn. 27-8
27.3.2.5.1 Left-Aligned Output Example
As an example of a left-aligned output, consider the following case:
Clock source = internal bus clock, where internal bus clock = 40 MHz (25 ns period)
PPOLn = 0, PWMPERn = 4, PWMDTYn = 1
PWMn frequency = 40 MHz ÷ 4 = 10 MHz
PWMn period = 100 ns
The output waveform generated is below:
PWMDTYn
Period = PWMPERn
PPOLn=0
PPOLn=1
PWMn frequency Clock (A, B, SA, or SB)
PWMPERn
----------------------------------------------------------
=
Duty Cycle 1 PWMPOL PPOLn[]
PWMDTYn
PWMPERn
-------------------------------
⎝⎠
⎛⎞
100%×=
PWMn Duty Cycle 1 1
4
---
⎝⎠
⎛⎞
100% 75%=×=