NUC970 Technical Reference Manual
Publication Release Date: Dec. 15, 2015
- 351 -
Revision V1.30
NUC97
0
T
E
CHNIC
A
L
RE
F
E
RE
N
CE
MA
NUA
L
Setup clock selector CLKSEL0 (PWM_CSR[2:0])
Setup prescaler PRESCALE01 (PWM_PPR[7:0])
Setup inverter on/off, dead zone generator on/off, periodic/one-shot mode and Stop PWM-timer
(PWM_PCR)
Setup interrupt enable register PIER0 (PWM_PIER[0])
Setup the corresponding GPI/O pins to PWM function
Setup PWM comparator register CMR (PWM_CMR[15:0]) and PWM counter register CNR
(PWM_CNR[15:0]) for setting PWM period and duty length
Enable PWM down-counter start running (Set CH0EN = 1 (PWM_PCR[0]))
The procedure mentioned above may be set up not in the order and PWM Timer can still work fine
PWM-Timer Stop Procedure
5.12.5.6
Take PWM channel 0 for example.
Method 1:
Set 16-bit down counter CNR (PWM_CNR[15:0]) as 0, and monitor data register PDR
(PWM_PDR[15:0]). When PDR (PWM_PDR[15:0]) reaches to 0, disable PWM Timer by setting
CH0EN = 0 (PWM_PCR[0] = 0). (Recommended)
Method 2:
Set 16-bit down counter CNR (PWM_CNR[15:0]) as 0. When interrupt request happen,
disable PWM Timer by setting CH0EN = 0 (PWM_PCR[0] = 0). (Recommended)
Method 3:
Disable PWM Timer by setting CH0EN = 0 (PWM_PCR[0] = 0). (Not recommended)