
NUC126
Aug. 08, 2018
Page
421
of 943
Rev 1.03
NUC12
6 S
E
RI
E
S
T
E
CH
NI
CA
L R
E
F
E
RE
NCE
MA
NUA
L
0
1
2
3
4
X
0
1
2
3
4
5
6
7
8
0
1
2
3
4
5
6
7
8
6
7
8
PWM Period
PWM Period
PWM Period
PERIOD = 5
PERIOD = 8
PERIOD = 8
zero point event
period point event
CNT
(PWM_CNTn[15:0])
CNTENn
(PWM_CNTEN[n])
5
Note:
n denotes channel 0,1..5
Figure 6.13-8 PWM Down Counter Type
6.13.5.5 Up-Down Counter Type
When PWM counter is set to up-down count type, CNTTYPEn (PWM_CTL1[2n+1:2n], n = 0,1..5) is
0x2, it starts counting-up from zero to PERIOD and then starts counting down to zero 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
center point event when the counter counts to PERIOD. Figure 6.13-9 shows an example of up-down
counter, wherein PWM period time = (2 * PERIOD) * (1) * PWMx_CLK. The DIRF
(PWM_CNTn[16]) bit is counter direction indicator flag, where high is up counting, and low is down
counting.
DIRF
(PWM_CNTn[16])
0
1
2
3
4
3
1
2
0
1
2
3
4
3
1
2
0
5
6
7
6
4
5
1
2
3
4
PWM Period
PERIOD = 4
PERIOD = 7
PWM Period
zero point event
center point event
CNT
(PWM_CNTn[15:0])
CNTENn
(PWM_CNTEN[n])
Note1:
When in up-down count type, period interrupt flag occurs at center point event.
Note2:
n denotes channel 0,1..5
X
Figure 6.13-9 PWM Up-Down Counter Type
6.13.5.6 PWM Comparator
There are two kinds of comparator registers
:
one is CMPDATn(n = 0,1..5), and the other is
FTCMPDATn_m(n = 0,2,4, m = 1,3,5) register. CMPDATn is a basic comparator register of PWM
channel n; In Independent mode each channel only has one comparetor, the value of CMPDATn
register
is continuously compared to the corresponding channel’s counter value. In Complementary
mode each paired channels has two comparetors, and the value of CMPDATn and CMPDATm (n =