GD32A50x User Manual
353
direction of timer is determined only by the
CI0FE0, only by the CI1FE1, or by the CI0FE0
and the
CI1FE1. The DIR bit is modified during the voltage level change of each direction
selection source. The mechanism of changing the counter direction is shown in
Counting direction in different quadrature decoder mode
. The quadrature decoder can
be regarded as an external clock with a direction selection. This means that the counter
counts continuously from 0 to the counter-reload value. Therefore, users must configure the
TIMERx_CAR register before the counter starts to count.
Table 18-5. Counting direction in different quadrature decoder mode
Counting mode
Level
CI0FE0
CI1FE1
Rising Falling
Rising Falling
Quadrature decoder mode 0
SMC[2:0]=3’b001
CI1FE1=1 Down
Up
-
-
CI1FE1=0
Up
Down
-
-
Quadrature decoder mode 1
SMC [2:0]=3’b010
CI0FE0=1
-
-
Up
Down
CI0FE0=0
-
-
Down
Up
Quadrature decoder mode 2
SMC
[2:0]=3’b011
CI1FE1=1 Down
Up
X
X
CI1FE1=0
Up
Down
X
X
CI0FE0=1
X
X
Up
Down
CI0FE0=0
X
X
Down
Up
Note:
"-" means "no counting"; "X" means impossible.
”0” means “low level”, ”1” means “high
level”.
Figure 18-31. Counter behavior with CI0FE0 polarity non-inverted in mode 2
CI0FE0
CI1FE1
CNT_REG
21
20
22
23
24
25
24
23
22
21
20
19
TIMERx_CAR
99