GD32W51x User Manual
454
prescaler register) are updated.
Figure 17-8. Timing chart of center-aligned counting mode
show some examples of the
counter behavior when TIMERx_CAR=0x63. TIMERx_PSC=0x0
Figure 17-8. Timing chart of center-aligned counting mode
Hardware set
Software clear
CEN
CNT_CLK
(PSC_CLK)
CNT_REG
03
02
01
00
01
02
.
62
63
62
61
.
01
00
Underflow
Overflow
TIMERx_CTL0 CAM = 2'b11
TIMER_CK
01
02
.
62
63
62
61
UPIF
CHxIF
CHxIF
TIMERx_CTL0 CAM = 2'b10 (upcount only
)
TIMERx_CTL0 CAM = 2'b10 (downcount only
)
CHxIF
Counter repetition
Counter Repetition is used to generator update event or updates the timer registers only after
a given number (N+1) of cycles of the counter, where N is CREP in TIMERx_CREP register.
The repetition counter is decremented at each counter overflow in up-counting mode, at each
counter underflow in down-counting mode or at each counter overflow and at each counter
underflow in center-aligned mode.
Setting the UPG bit in the TIMERx_SWEVG register will reload the content of CREP in
TIMERx_CREP register and generator an update event.
For odd values of CREP in center-aligned mode, the update event occurs either on the
overflow or on the underflow depending on when the CREP register was written and when
the counter was started. The update event generated at overflow when the CREP was written
before starting the counter, and generated at underflow when the CREP was written after