
MS51
Dec. 17, 2019
Page
283
of 316
Rev 1.01
M
S51
SE
RIES
TE
CHNICA
L REF
ERE
N
CE MA
NU
A
L
6.11 Pulse Width Modulated (PWM)
The PWM (Pulse Width Modulation) signal is a useful control solution in wide application field. It can
used on motor driving, fan control, backlight brightness tuning, LED light dimming, or simulating as a
simple digital to analog converter output through a low pass filter circuit.
The MS51 PWM is especially designed for motor control by providing three pairs, maximum 16-bit
resolution of PWM output with programmable period and duty. The architecture makes user easy to
drive the one-phase or three-phase brushless DC motor (BLDC), or three-phase AC induction motor.
Each of six PWM can be configured as one of independent mode, complementary mode, or
synchronous mode. If the complementary mode is used, a programmable dead-time insertion is
available to protect MOS turn-on simultaneously. The PWM waveform can be edge-aligned or center-
aligned with variable interrupt points.
6.11.1
PWM Generator
The PWM generator is clocked by the system clock or Timer 1 overflow divided by a PWM clock pre-
scalar selectable from 1/1~1/128. The PWM period is defined by effective 16-bit period registers,
{PWMnPH, PWMnPL}. The period is the same for all PWM channels for they share the same 16-bit
period counter. The duty of each PWM is determined independently by the value of duty registers
{PWMnC0H, PWMnC0L}, {PWMnC1H, PWMnC1L}, {PWMnC2H, PWMnC2L}, {PWMnC3H,
PWMnC3L}, {PWMnC4H, PWMnC4L}, and {PWMnC5H, PWMnC5L}. With six duty registers, six PWM
output can be generated independently with different duty cycles. The interval and duty of PWM signal
is generated by a 16-bit counter comparing with the period and duty registers.
To facilitate the three-phase motor control, a group mode can be used by setting GP (PWMnCON1.5),
which makes {PWMnC0H, PWMnC0L} and {PWMnC1H, PWMnC1L} duty register decide duties of the
PWM outputs. In a three-phase motor control application, two-group PWM outputs generally are given
the same duty cycle. When the group mode is enabled, {PWMnC2H, PWMnC2L}, {PWMnC3H,
PWMnC3L}, {PWMnC4H, PWMnC4L} and {PWMnC5H, PWMnC5L} registers have no effect. This
mean is {PWMnC2H, PWMnC2L} and {PWMnC4H, PWMnC4L} both as same as {PWMnC0H,
PWMnC0L}. Also {PWMnC3H, PWMnC3L} and {PWMnC5H, PWMnC5L} are same as {PWMnC1H,
PWMnC1L}.Note that enabling PWM does not configure the I/O pins into their output mode
automatically. User should configure I/O output mode via software manually.