![GigaDevice Semiconductor GD32E23 Series User Manual Download Page 245](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794245.webp)
GD32E23x User Manual
245
Result
: When the wanted input signal is captured, TIMERx_CHxCV will be set by counter’s
value and CHxIF is asserted. If the CHxIF is 1, the CHxOF will also be asserted. The
interrupt and DMA request will be asserted or not based on the configuration of CHxIE and
CHxDEN in TIMERx_DMAINTEN.
Direct generation
: A DMA request or interrupt is generated by setting CHxG directly.
The channel input capture function can be also used for pulse width measurement from
signals on the TIMERx_CHx pins. For example, PWM signal connects to CI0 input. Select
CI0 as channel 0 capture signals by setting CH0MS to 2’b01 in the channel control register
(TIMERx_CHCTL0) and set capture on rising edge. Select CI0 as channel 1 capture signal
by setting CH1MS to 2’b10 in the channel control register (TIMERx_CHCTL0) and set
capture on falling edge. The counter is set to restart mode and is restarted on channel 0
rising edge. Then the TIMERX_CH0CV can measure the PWM period and the
TIMERx_CH1CV can measure the PWM duty cycle.
Channel output compare function
Figure 14-13.
Channel output compare principle
(with complementary output,
x=0,1,2)
Capture/
compare register
CHxCV
Counter
o
u
tp
u
t
c
o
m
p
a
ra
to
r
Compare
output control
CHxCOMCTL
CNT>CHxCV
CNT=CHxCV
CNT<CHxCV
Output
complementary
protection
register
&Dead-Time
Output enable
and polarity
selector
CHxP,CHxNP
CHxE,CHxNE
OxCPRE
CHx_O
CHx_ON
Figure 14-14.
Channel output compare principle
(CH3_O)
Capture/
compare register
CH3CV
Counter
o
u
tp
u
t
co
m
p
a
ra
to
r
Compare output
control
CH3COMCTL
Output enable
and polarity
selector
CH3P,CH3E
O3CPRE
CH3_O
CNT>CH3CV
CNT=CH3CV
CNT<CH3CV
Figure 14-13. Channel output compare principle (with complementary output,
and
Figure 14-14. Channel output compare principle (CH3_O)
show the principle
circuit of channels output compare function. The relationship between the channel output
signal CHx_O/CHx_ON and the OxCPRE signal (more details refer to
) is described as blew: The active level of O0CPRE is high, the output level of
CH0_O/CH0_ON depends on OxCPRE signal, CHxP/CHxNP bit and CH0E/CH0NE bit
(please refer to the TIMERx_CHCTL2 register for more details). For examples,