General Timers
User Manual All information provided in this document is subject to legal disclaimers. © REALTEK 2019. All rights reserved.
197
setting the UG bit generates an update event but without setting the UIF flag, thus no interrupt is sent. This is to avoid generating both update
and capture interrupts when clearing the counter on the capture event.
When an update event occurs, all the registers are updated and the update flag (the UIF bit in TIMx_SR) is set depending on the URS bit:
The auto-reload shadow register is updated with the preload value (TIMx_ARR).
The buffer of the prescaler is reloaded with the preload value (the content of the TIMx_PSC register).
10.2.4.2
Statistic Pulse Width
In pulse mode 0, setting ‘0’ in the CC0M bit of the TIMx_CCR0 register, the pulse timer can count the width of active level of TRGI. When the
TRGI is transferred to active level from inactive level, the counter is enabled automatically. When the TRGI is transferred to inactive level from
active level, the counter is disabled automatically, the CC0IF is set and the current counter value is copied to CCR0 field of the TIMx_CCR0
register.
Fig 10-3 gives an example of statistic pulse width mode when prescaler division is 1 and positive edge of TRGI is active for capture.
Timer clock = CK_CNT
CK_PSC
CEN
00
Counter register
CCRx
00
TRGI
01
02
03
04
04
01
02
03
03
Clear CC0IF
by Software
Capture/ompare
interrupt flag (CC0IF)
00
00
Fig 10-3 Statistic pulse width mode diagram (positive edge of TRGI is active for capture)
10.2.4.3
Statistic Pulse Number
In pulse mode 1, setting ‘1’ in the CC0M bit of the TIMx_CCR0 register, the pulse timer can count the number of active edge of TRGI in the
given period. When the counter overflows, the CC0IF is set and the number is copied to CCR0 field of the TIMx_CCR0 register.
Fig 10-4 gives an example of statistic pulse number mode when prescaler division is 1, positive edge of TRGI is active for capture, and the ARR
field equals to E6.
Realtek confidential files
The document authorized to
SZ99iot
2019-05-15 10:08:03