Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
282
/
631
Basic timers description
Time-base unit
The time-base unit mainly includes: prescaler, counter and auto-reload. When the time base unit is working, the
software can read and write the corresponding registers (TIMx_PSC, TIMx_CNT and TIMx_AR) at any time.
Depending on the setting of the auto-reload preload enable bit (TIMx_CTRL1.ARPEN), the value of the preload
register is transferred to the shadow register immediately or at each update event UEV. An update event is generated
when the counter reaches the overflow condition and it can be generated by software when TIMx_CTRL1.UPDIS=0.
The counter CK_CNT is valid only when the TIMx_CTRL1.CNTEN bit is set. The counter starts counting one clock
cycle after the TIMx_CTRL1.CNTEN bit is set.
Prescaler description
The TIMx_PSC register consists of a 16-bit counter that can be used to divide the counter clock frequency by any
factor between 1 and 65536. It can be changed on the fly as it is buffered. The prescaler value is only taken into
account at the next update event.
Figure 12-2 Counter timing diagram with prescaler division change from 1 to 4
CK_PSC
CNTEN
Timer Clock = CK_CNT
Counter register
Update event
(
UEV
)
Prescaler controller register
Write a new value in TIMx_PSC
Prescaler buffer
Prescaler counter
1
2
3
0
1
3
0
88
87
89 8A 8B 8C
00
01
0
3
0
3
0
2