Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
248
/
631
To be on the safe side, user is suggested setting TIMx_EVTGEN.UDGN to generate an update by software
before starting the counter, and not writing the counter while it is running.
PWM edge-aligned mode
There are two kinds of configuration in edge-aligned mode, up-counting and down-counting.
Up-counting
User can set TIMx_CTRL1.DIR=0 to make counter counts up.
Here is an example for PWM mode1.
When TIMx_CNT < TIMx_CCDATx, the reference PWM signal OCxREF is high. Otherwise it will be low. If the
compare value in TIMx_CCDATx is greater than the auto-reload value, the OCxREF will remains 1. Conversely, if
the compare value is 0, the OCxREF will remains 0.
When TIMx_AR=8, the PWM waveforms are as follow.
Figure 11-19 Edge-aligned PWM waveform (APR=8)
Down-counting
User can set TIMx_CTRL1.DIR=1 to make counter counts down.
Here is an example for PWM mode1.
When TIMx_CNT > TIMx_CCDATx, the reference PWM signal OCxREF is low. Otherwise it will be high. If the
compare value in TIMx_CCDATx is greater than the auto-reload value, the OCxREF will remains 1.
OCXREF
Counter register
0
1
2
3
4
5
6
7
8
0
1
CCxIF
CCDATx=4
OCXREF
CCxIF
CCDATx=8
OCXREF
CCxIF
CCDATx>8
OCXREF
CCxIF
CCDATx=0
0
1