
Rev. 1.00
185 of 486
July 31, 2018
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F50231/HT32F50241
13 General-Purpose T
imer (GPTM)
13
General-Purpose Timer (GPTM)
Introduction
The General-Purpose Timer consists of one 16-bit up / down-counter, four 16-bit Capture /
Compare Registers (CCRs), one 16-bit Counter-Reload Register (CRR) and several control / status
registers. It can be used for a variety of purposes including general timer, input signal pulse width
measurement or output waveform generation such as single pulse generation or PWM output. The
GPTM supports an encoder interface using a quadrature decoder with two inputs.
TRCED
XOR
TI0
GT_CH0
GT_CH1
GT_CH2
GT_CH3
Input Filter
& Polarity Selection
& Edge Detection
CH0
PRESCALER
CH1
PRESCALER
CH2
PRESCALER
CH3
PRESCALER
CH1 Capture/Compare
Register (CH1CCR)
CH2 Capture/Compare
Register (CH2CCR)
CH3 Capture/Compare
Register (CH3CCR)
TM_CNT
CH0 Capture/Compare
Register (CH0CCR)
Reload Register
(CRR)
Output
Control
Output
Control
Output
Control
Output
Control
GT_CH0O
GT_CH1O
GT_CH2O
GT_CH3O
TI1
TI2
TI3
PSC
PRESCALER
Input Filter
& Polarity Selection
& Edge Detection
Edge
Detector
ITI0
ITI1
ITI2
TI0S0ED
TI0S1ED
TI1S0ED
TI1S1ED
Input Filter
& Polarity Selection
& Edge Detection
Input Filter
& Polarity Selection
& Edge Detection
TI2S2ED
TI2S3ED
TI3S2ED
TI3S3ED
TRCED
STIED
TI0S0ED
TI1S1ED
TI0BED
TI1S0ED
TI0S1ED
TI0S0
TI1S1
Quadrature
Decoder
CLKPULSE
Clock
Controller
f
CLKIN
CK_CNT
CK_PSC
Slave
Controller
Up/Dn
Control
STI
CH0OREF
CH1OREF
CH2OREF
CH3OREF
Restart
Pause
Trigger
Up/Dn
CEV0
CEV2
CEV1
CEV3
Master
Controller
MEV0
MEV1
MEV2
MEV3
UEV
TEV
TME
CHxOREF
(x = 0 ~ 3)
CEVx
UEV
MTO
To other Timers
To ADC
UEVG
UEVG
CEVx : Channel x Capture Event
UEV : Update Event
TEV : Trigger Event
MEVx : Channel x Compare Match Event
MDCFR
Register
Figure 30. GPTM Block Diagram
Features
▄
16-bit up / down auto-reload counter
▄
16-bit programmable prescaler that allows division of the counter clock frequency by any factor
between 1 and 65536
▄
Up to 4 independent channels for:
●
Input Capture function
●
Compare Match Output