
NUC126
Aug. 08, 2018
Page
422
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,2,4, m = 1,3,5) registers are continuously compared to the complementary even channel
’s counter
value, because of
odd channel’s counter is useless. For example, channel 0 and channel 1 are
complementary channels, in Complementary mode, channel 1’s comparator is continuously compared
to channel 0’s counter, but not channel 1’s. When the counter is equal to value of CMPDAT0 register,
PWM generates a compared point event and uses the event to generate PWM pulse, interrupt or use
to trigger ADC. In up-down counter type, two events will be generated in a PWM period as shown in
Figure 6.13-10. The CMPU is up count compared point event and CMPD is down count compared
point event.
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
CMPDAT = 4
PERIOD = 7
CMPDAT = 5
PWM Period
Up-count compared
point event (CMPU)
Down-count compared
point event (CMPD)
PERIOD = 5
CMPDAT= 0
CNT
(PWM_CNTn[15:0])
Note1:
No CMPU event occurred when CMPDAT equals to PERIOD.
Note2:
n denotes channel 0,1..5
Figure 6.13-10 PWM Compared point Events in Up-Down Counter Type
FTCMPDAT is a free trigger comparator register. Each complementary paired channel only supports
one free trigger comparator. The value of FTCMPDATn_m( n = 0,2,4, m = 1,3,5) register is
continuously compared to even channel
’s counter value. When counter is equal to value of
FTCMPDAT register, PWM generates an event and only uses to trigger ADC.
6.13.5.7 PWM Double Buffering
The double buffering uses double buffers to separate software writing and hardware action operation
timing. There are four loading modes for loading values to buffer: period loading mode, immediately
loading mode, window loading mode and center loading mode. After registers are modified through
software, hardware will load register value to the buffer register according to the loading mode timing.
The hardware action is based on the buffer value. This can prevent asynchronously operation problem
due to software and hardware asynchronism.
The PWM provides PBUF (PWM_PBUFn[15:0]) as the active PERIOD buffer register, CMPBUF
(PWM_CMPBUFn[15:0])
as
the
active
CMPDAT
buffer
register,
FTCMPBUF
(PWM_FTCMPBUFn_m[15:0]) as the active FTCMPDAT buffer register and CPSCBUF
(PWM_CPSCBUFn_m[15:0]) as the active CLKPSC buffer register. The concept of double buffering is
used in loading modes, which are described in the following sections. For example, as shown inFigure
6.13-11, in period loading mode, writing PERIOD, CMPDAT and FTCMPDAT registers through
software, PWM will load new values to their buffer PBUF (PWM_PBUFn[15:0]), CMPBUF
(PWM_CMPBUFn[15:0]) and FTCMPBUF (PWM_FTCBUF[15:0]) at start of the next period without
affecting the current period counter operation. FTCMPU denotes up-count free trigger compared point
event and FTCMPD denotes down-count free trigger compared event.