English
Language : 

MC9S12P128_10 Datasheet, PDF (358/566 Pages) Freescale Semiconductor, Inc – S12 Microcontrollers
Pulse-Width Modulator (PWM8B6CV1) Block Description
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 10-35 as well as performing a load from the double buffer period and
duty register to the associated registers as described in Section 10.4.2.3, “PWM Period and Duty.” The
counter counts from 0 to the value in the period register – 1.
NOTE
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.
PPOLx = 0
PPOLx = 1
PWMDTYx
Period = PWMPERx
Figure 10-36. 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.
• PWMx frequency = clock (A, B, SA, or SB) / PWMPERx
• PWMx duty cycle (high time as a% of period):
— Polarity = 0 (PPOLx = 0)
Duty cycle = [(PWMPERx-PWMDTYx)/PWMPERx] * 100%
— Polarity = 1 (PPOLx = 1)
Duty cycle = [PWMDTYx / PWMPERx] * 100%
As an example of a left aligned output, consider the following case:
Clock source = bus clock, where bus clock = 10 MHz (100 ns period)
PPOLx = 0
PWMPERx = 4
PWMDTYx = 1
PWMx frequency = 10 MHz/4 = 2.5 MHz
PWMx period = 400 ns
PWMx duty cycle = 3/4 *100% = 75%
Shown below is the output waveform generated.
S12P-Family Reference Manual, Rev. 1.13
358
Freescale Semiconductor