GD32W51x User Manual
510
Down counting mode
In this mode, the counter counts down continuously from the counter-reload value, which is
defined in the TIMERx_CAR register, to 0 in a count-down direction. Once the counter
reaches to 0, the counter restarts to count again from the counter-reload value. If the repetition
counter is set, the update event was generated after the number (TIME1) of
underflow. Else the update event is generated at each counter underflow. The counting
direction bit DIR in the TIMERx_CTL0 register should be set to 1 for the down-counting mode.
When the update event is set by the UPG bit in the TIMERx_SWEVG register, the counter
value will be initialized to the counter-reload value and generates an update event.
If the UPDIS bit in TIMERx_CTL0 register is set, the update event is disabled.
When an update event occurs, all the registers (repetition counter, auto reload register,
prescaler register) are updated.
Figure 17-39. Timing chart of down counting mode,PSC=0/1
chart of down counting mode, change TIMERx_CAR ongoing
show some examples of
the counter behavior for different clock frequencies when TIMERx_CAR=0x63.
Figure 17-39. Timing chart of down counting mode,PSC=0/1
CEN
CNT_CLK(PSC_CLK)
CNT_REG
05
04
03
02
01
00
63
62
61
60
5F
5E
5C
5B
Update event (UPE)
Update interrupt flag (UPIF)
CNT_REG
04
03
Update event (UPE)
Update interrupt flag (UPIF)
Hardware set
Software clear
Hardware set
TIMERx_PSC PSC == 0
TIMERx_PSC PSC == 1
TIMER_CK
5A
00
01
02
63
62
61
CNT_CLK(PSC_CLK)