GD32F10x User Manual
403
Result:
W
hen you wanted input signal is got, TIMERx_CHxCV will be set by Counter’s value.
And CHxIF is asserted. If the CHxIF is high, the CHxOF will be asserted also. The interrupt
will be asserted based on the your configuration of CHxIE 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 15-73.
Channel output compare principle (x=0)
Capture/
compare register
CHxCV
Counter
o
u
tp
u
t
c
o
m
p
a
ra
to
r
Compare output
control
CHxCOMCTL
Output enable
and polarity
selector
CHxP,CHxE
OxCPRE
CHx_O
CNT>CHxCV
CNT=CHxCV
CNT<CHxCV
Figure 15-73. Channel output compare principle (x=0)
shows the principle circuit of
channels output compare function. The relationship between the channel output signal
CHx_O 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 depends
on OxCPRE signal, CHxP bit and CH0P bit (please refer to the TIMERx_CHCTL2 register for
more details).For example, 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;
If the output of OxCPRE is inactive(low) level, the output of CHx_O is active(low) level.
In channel Compare function, the TIMERx can generate timed pulses with programmable
position, polarity, duration, and frequency. When the counter matches the value in the
CHxVAL register of an output compare channel, the channel (n) output can be set, cleared,
or toggled based on CHxCOMCTL. when the counter reaches the value in the CHxVAL
register, the CHxIF bit is set and the channel (n) interrupt is generated if CHxIE = 1.
So the process can be divided to several steps as below:
Содержание GD32F10 Series
Страница 1: ...GigaDevice Semiconductor Inc GD32F10x Arm Cortex M3 32 bit MCU User Manual Revision 2 6 Jun 2022 ...
Страница 63: ...GD32F10x User Manual 63 programmed during the chip production ...
Страница 117: ...GD32F10x User Manual 117 010 1 0 011 0 9 ...
Страница 416: ...GD32F10x User Manual 416 shadow register updates every update event ...
Страница 427: ...GD32F10x User Manual 427 value ...
Страница 518: ...GD32F10x User Manual 518 These bits are not used in SPI mode ...