GD32F10x User Manual
281
(please refer to the TIMERx_CHCTL2 register for more details). For examples,
1)
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.
2)
Configure CHxNP=0 (the active level of CHx_ON is low, contrary to OxCPRE), CHxNE=1
(the output of CHx_ON is enabled),
If the output of OxCPRE is active(high) level, the output of CHx_O is active(low) level;
If the output of OxCPRE is inactive(low) level, the output of CHx_O is active(high) level.
When CH0_O and CH0_ON are output at the same time, the specific outputs of CH0_O and
CH0_ON are related to the relevant bits (ROS, IOS, POE and DTCFG bits) in the
TIMERx_CCHP register.
In channel output compare function, the TIMERx can generate timed pulses with
programmable position, polarity, duration and frequency. When the counter matches the value
in the TIMERx_CHxCV 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
TIMERx_CHxCV register, the CHxIF bit is set and the channel (n) interrupt is generated if
CHxIE = 1. And the DMA request will be asserted, if CxCDE=1.
So, the process can be divided to several steps as below:
Step1:
Clock Configuration. Such as clock source, clock prescaler and so on.
Step2:
Compare mode configuration.
Set the shadow enable mode by CHxCOMSEN
Set the output mode (Set/Clear/Toggle) by CHxCOMCTL.
Select the active high polarity by CHxP/CHxNP
Enable the output by CHxEN
Step3:
Interrupt/DMA-request enables configuration by CHxIE/CxCDE
Step4:
Compare output timing configuration by TIMERx_CAR and TIMERx_CHxCV
About the TIMERx_CHxCV; you can change it on the go to meet the waveform you
expected.
Step5:
Start the counter by CEN.
Figure 15-15. Output-compare in three modes
toggle/set/clear. CAR=0x63, CHxVAL=0x3
Содержание 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 ...