
M0A21/M0A23 Series
May 06, 2022
Page
344
of 746
Rev 1.02
M0
A21
/M
0
A
2
3
SE
RIES
TEC
H
NICAL
RE
FEREN
C
E
M
ANUAL
0
1
CNT
(PWM_CNT0[15:0])
4
Prescale counter
CLKPSC
(PWM_CLKPSC0_1[11:0])
3 2 1 0
3
CNTEN0
(PWM_CNTEN[0])
4 3 2 1 0 4 3 2 1 0
5 4 3 2 1
6
0
0
2
4
6
PWM0_CLK
4
6
4 3 2 1 0
x
Figure 6.10-6 PWM0_CH0 Prescaler Waveform in Up Counter Type
6.10.5.2 PWM Counter
PWM supports 3 counter types operation: Up Counter, Down Counter and Up-Down Counter types.
To clear PWM counter, take PWM channel0 for an example, CNT(PWM_CNT0[15:0]) can clear to 0x00
by CNTCLR0 (PWM_CNTCLR[0]). CNT will be cleared when prescale counter counts to 0, and
CNTCLR0 will be set 0 by hardware automatically.
0
1
CNT
(PWM_CNT0[15:0])
4
Prescale counter
3 2 1 0
CNTEN0
(PWM_CNTEN[0])
4 3 2 1 0 4 3 2 1 0
3 2 1 0 4
4
3
0
2
1
2
PWM0_CLK
4 3 2 1 0
x
CNTCLR0
(PWM_CNTCLR[0])
0
PCLK
Figure 6.10-7 PWMx Counter Waveform When Setting Clear Counter
6.10.5.3 Up Counter Type
When PWM counter is set to up counter type, CNTTYPEn (PWM_CTL1[2n+1:2n], n = 0,1..5) is 0x0, it
starts up-counting from 0 to PERIOD (PWM_PERIODn[15:0], where n denotes channel number) to
complete a PWM period. The current counter value can be read from CNT (PWM_CNTn[15:0]) bits.
PWM generates zero point event when the counter counts to 0 and prescale counts to 0. PWM
generates period point event when the counter counts to PERIOD and prescale counts to 0. Figure
6.10-8 shows an example of up counter, wherein
PWM period time = (1) *(1)* PWMx_CLK.