11-9
MSM66573 Family User's Manual
Chapter 11 PWM Function
11
(8)
PWM control register 0 (PWMCON0)
Setting both bits 5 and 6 (PWCK10 and PWCK11) to "1" cascades the two counters (16-
bit mode) so that overflow of PWM counter 0 (PWC0) is the clock input to PWM counter 1
(PWC1), thereby forming 16-bit PWM counter (PWC).
Bits 1 and 2 (PWCK00 and
PWCK01) specify the count clock. Bits 3 and 7 (PWC0OV and PWC1OV) specify the
interrupt factor for PWINT0 and PWINT1 interrupt requests. Leaving bit 4 (PW1RUN) set
to "1" allows starting and stopping during the 16-bit mode to be controlled with only bit 0
(PW0RUN).
(9)
PWM control register 1 (PWMCON1)
Bit 0 (PWHSM) specifies normal 16-bit mode or high-speed mode. During the high-speed
mode, starting and stopping can be controlled with only bit 4 (PW1RUN) of PWCON0.
[Equation to Calculate 16-Bit PWM Cycle]
f(PWM16) = PWCLK / (65536 – PWCY)
f(PWM16) : PWM cycle [Hz]
PWCLK : PWM input clock frequency [Hz]
PWCY
: Value of PWCY (16 bits)
11.4 PWM Operation
11.4.1 PWM Operation During 8-bit Mode
During the 8-bit mode, PWM output can use the four output pins of PWM0OUT through
PWM3OUT.
The output from the PWMnOUT pin (where n = 0 to 3) goes to the High level the moment
the corresponding pin P7_6, P7_7, P8_6, or P8_7 is configured as a secondary function
output.
PWM is started by setting the corresponding RUN bit (PW0RUN, PW1RUN) to "1". When
the corresponding RUN bit becomes 1, PWC0 and/or PWC1 begin counting, at the same
time the output flip-flop is set to "1". PWC0 and PWC1 continue to count upward. When their
value matches the contents of the corresponding PWRn, an interrupt request is generated,
the output flip-flop is reset to "0", and a Low level is output from the PWMnOUT pin. If PWC0
and PWC1 overflow, the output flip-flop is set to "1", and the PWMnOUT pin outputs a High
level. Also, the value of PWCY0 and PWCY1 is loaded into PWC0 and PWC1. Thereafter,
until the RUN bit is reset to "0", this operation will repeat and the duty controlled waveform
will be output from the PWMnOUT pin. When the RUN bit is reset to "0", a High level is
output to the PWMnOut pin.
[Note]
Depending upon the count clock selected for PWC0 and PWC1, immediately after PWM
is started, the PWM output duty may be shortened (for one cycle only).
If the value of PWC0 and PWC1 is 00H, and the value of the corresponding PWRn is 00H,
the duty output is 1/256. Increasing the value of PWRn increases the output duty (High
level). If the value of PWRn is FFH, the output is 256/256 or 100% duty. To realize 0/
256 or 0% duty, use the port 1 primary function since 0% duty cannot be realized with the
PWM function.
Figure 11-4 shows an example of PWM output operation.