MS51
Dec. 17, 2019
Page
286
of 316
Rev 1.01
M
S51
SE
RIES
TE
CHNICA
L REF
ERE
N
CE MA
NU
A
L
6.11.2 PWM Types
The PWM generator provides two PWM types: edge-aligned or center-aligned. PWM type is selected
by PWMTYP (PWMnCON1.4).
Edge-Aligned Type
6.11.2.1
In edge-aligned mode, the 16-bit counter uses single slop operation by counting up from 0000H to
{PWMnPH, PWMnPL} and then starting from 0000H. The PWM generator signal (PGn before PWM
and Fault Brake output control) is cleared on the compare match of 16-bit counter and the duty
register {PWMnH, PWMnL} and set at the 16-bit counter is 0000H. The result PWM output waveform
is left-edge aligned.
PWMnP (2nd)
PWMnP (1st)
PWMnCH01
(2nd)
PWMnCH01
(1st)
PG01 output
Load
PWMnCH01
(2nd)
Load
PWMnP (2nd)
PWMnCH01
(2nd)
duty valid
PWMnP (2nd) period
valid
12-bit counter
Figure 6.11-3 PWM Edge-aligned Type Waveform
The output frequency and duty cycle for edge-aligned PWM are given by following equations:
PWM frequency =
1
}
,
{
PWMnPL
PWMnPH
F
PWM
(F
PWM
is the PWM clock source frequency divided by
PWMDIV).
PWM high level duty =
1
}
,
{
}
,
{
PWMnPL
PWMnPH
PWMnCHxL
PWMnCHxH
.
Center-Aligned Type
6.11.2.2
In center-aligned mode, the 16-bit counter use dual slop operation by counting up from 0000H to
{PWMnPH, PWMnPL} and then counting down from {PWMnPH, PWMnPL} to 0000H. The PGn signal
is cleared on the up-count compare match of 16-bit counter and the duty register {PWMnH, PWMnL}
and set on the down-count compare match. Center-aligned PWM may be used to generate
non-
overlapping waveforms.