![GigaDevice Semiconductor GD32L23 Series Скачать руководство пользователя страница 302](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32l23-series/gd32l23-series_user-manual_2225804302.webp)
GD32L23x User Manual
302
register, at the same time the CHxIF bit is set and the channel interrupt is generated if it is
enabled when CHxIE=1.
Figure 17-9. Input capture logic
CI0
Synchronizer
D
presclare
Capture
Register
(
CH0VAL
)
Clock
Processer
Counter
TIMER_CK
Q
Filter
D
Q
D
Q
Edge Detector
CI1FE0
ITS
CH0MS
CH0IF
CH0IE
CH0_CC_I
TIMERx_CC_INT
Capture INT From Other Channal
CH0CAPPSC
Edge selector
&inverter
Based on
CH0P
CI0FE0
Rising/Falling
ITI0
ITI3
ITI1
ITI2
IS0
The input signals of channelx (CIx) can be the TIMERx_CHx signal or the XOR signal of the
TIMERx_CH0, TIMERx_CH1 and TIMERx_CH2 signals. First, the input signal of channel (CIx)
is synchronized to TIMER_CK signal, and then sampled by a digital filter to generate a filtered
input signal. Then through the edge detector, the rising or falling edge is detected by
configuring CHxP bit. The input capture signal can also be selected from the input signal of
other channel or the internal trigger signal by configuring CHxMS bits. The IC prescaler makes
several input events generate one effective capture event. On the capture event,
TIMERx_CHxCV will store the value of counter.
So, the process can be divided into several steps as below:
Step1
: Filter configuration (CHxCAPFLT in TIMERx_CHCTL0).
Based on the input signal and quality of requested signal, configure compatible
CHxCAPFLT.
Step2
: Edge selection (CHxP/CHxNP in TIMERx_CHCTL2).
Rising edge or falling edge, choose one by configuring CHxP/CHxNP bits.
Step3
: Capture source selection (CHxMS in TIMERx_CHCTL0)
As soon as selecting one input capture source by CHxMS, the channel must be set to
input mode (CHxMS! =0x0) and TIMERx_CHxCV cannot be written any more.
Step4
: Interrupt enable (CHxIE and CHxDEN in TIMERx_DMAINTEN)