![GigaDevice Semiconductor GD32E23 Series User Manual Download Page 355](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794355.webp)
GD32E23x User Manual
355
CHxDEN in TIMERx_DMAINTEN
Direct generation
: if you want to generate a DMA request or Interrupt, you can set CHxG by
software 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 connect to CI0 input. Select
channel 0 capture signals to CI0 by setting CH0MS to 2’b01 in the channel control register
(TIMERx_CHCTL0) and set capture on rising edge. Select channel 1 capture signal to CI0
by
setting CH1MS to 2’b10 in the channel control register (TIMERx_CHCTL0) and set
capture on falling edge. The counter set to restart mode and restart on channel 0 rising edge.
Then the TIMERX_CH0CV can measure the PWM period and the TIMERx_CH1CV can
measure the PWM duty.
Channel output compare function
Figure 14-60.
Channel output compare principle
(with complementary output, x=0)
Capture/
compare register
CH0CV
Counter
o
u
tp
u
t
co
m
p
a
ra
to
r
Compare
output control
CH0COMCTL
CNT>CH0CV
CNT=CH0CV
CNT<CH0CV
Output
complementary
protection
register
&Dead-Time
Output enable
and polarity
selector
CH0P,CH0NP
CH0E,CH0NE
O0CPRE
CH0_O
CH0_ON
Figure 14-61. Channel output compare principle (CH1_O)
Capture/
compare register
CH1CV
Counter
o
u
tp
u
t
c
o
m
p
a
ra
to
r
Compare output
control
CH1COMCTL
Output enable
and polarity
selector
CH1P,CH1E
O1CPRE
CH1_O
CNT>CH1CV
CNT=CH1CV
CNT<CH1CV
Figure 14-60. Channel output compare principle (with complementary output, x=0)
Figure 14-61. Channel output compare principle (CH1_O)
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, configure
CHxP=0 (the active level of CHx_O is high, the same as OxCPRE), CHxE=1 (the output of
CHx_O is enabled):
If the output of OxCPRE is active(high) level, the output of CHx_O is active(high) level;