
Rev. 1.00
199 of 486
July 31, 2018
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F50231/HT32F50241
13 General-Purpose T
imer (GPTM)
Quadrature Decoder
The Quadrature Decoder function uses two quadrantal inputs TI0 and TI1 derived from the GT_
CH0 and GT_CH1 pins respectively to interact to generate the counter value. The DIR bit is
modified by hardware automatically during each input source transition. The input source can be
either TI0 only, TI1 only or both TI0 and TI1, the selection made by setting the SMSEL field to
0x1, 0x2 or 0x3. The mechanism for changing the counter direction is shown in the following table.
The Quadrature decoder can be regarded as an external clock with a directional selection. This
means that the counter counts continuously in the interval between 0 and the counter-reload value.
Therefore, users must configure the CRR register before the counter starts to count.
Filter
TI0FP
TI0FN
TI0F
GT_CH0
f
sampling
CH0P
Filter
TI1FP
TI1FN
TI1F
CH1P
GT_CH1
TI0S0
TI1S0
TI0S1
TI1S1
TRCED
CH0PRESCALER
CH1PRESCALER
TI0S0ED
CH0PSC
CH1PSC
CH0CCS
CH1CCS
CH0PSC
CH1PSC
CH0CAP Event
CH1CAP Event
Edge
Detection
Edge
Detection
Edge
Detection
Edge
Detection
TI1S0ED
TI0S1ED
TI1S1ED
f
CLKIN
GT_CH1
GT_CH2
TI0SRC
TI0XOR
Edge
Detection
Edge
Detection
TI0BED
XOR
f
sampling
f
CLKIN
TI1
TI0
Quadrature
Decoder
SMSEL
TI1S1
TI0S0
TI1S1ED
TI0S1ED
TI1S0ED
TI0S0ED
Figure 48. Input Stage and Quadrature Decoder Block Diagram