NuMicro® NUC029LEE/NUC029SEE
32-bit Arm
®
Cortex
®
-M0 Microcontroller
Aug, 2018
Page
264
of
497
Rev 1.00
N
U
MICRO
®
N
UC02
9L
E
E
/N
UC029
S
E
E
T
E
CHN
ICA
L R
E
F
E
R
E
NC
E
M
A
NU
A
L
6.9.5.13 PWM-Timer Stop Procedure
Method 1:
Set 16-bit counter (CNR) as 0, and monitor PDR (current value of 16-bit down-counter). When
PDR reaches to 0, disable PWM-Timer (CHnEN in PCR).
(Recommended)
Method 2:
Set 16-bit counter (CNR) as 0. When interrupt request happened, disable PWM-Timer (CHnEN in
PCR).
(Recommended)
Method 3:
Disable PWM-Timer directly ((CHnEN in PCR).
(Not recommended)
The reason why method 3 is not recommended is that disable CHnEN will immediately stop PWM
output signal and lead to change the duty of the PWM output, this may cause damage to the
control circuit of motor
6.9.5.14 Capture Start Procedure
1.
Setup clock source divider select register (CSR)
2.
Wait until SYNCBUSYn be set to 0 by hardware (if PWM clock source is not from
HCLK)
3.
Setup prescaler (PPR)
4.
Setup channel enabled, rising/falling interrupt enable and input signal inverter on/off
(CCR0, CCR2)
5.
Wait until SYNCBUSYn be set to 0 by hardware (if PWM clock source is not from
HCLK)
6.
Setup Auto-reload mode, Edge-aligned type and Stop PWM-timer (PCR)
7.
Wait until SYNCBUSYn be set to 0 by hardware (if PWM clock source is not from
HCLK)
8.
Setup PWM down-counter (CNR)
9.
Enable PWM timer start running (Set CHnEN = 1 in PCR)
10. Setup corresponding GPIO pins as capture function (disable POE and enable
CAPENR) for the corresponding PWM channel.