![GigaDevice Semiconductor GD32E23 Series User Manual Download Page 356](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794356.webp)
GD32E23x User Manual
356
If the output of OxCPRE is inactive(low) level, the output of CHx_O is active(low) level.
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. Please refer to
Channel output complementary PWM
for more
details.
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 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.
And the DMA request will be assert, if CHxDEN =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/ CHxDEN
Step4:
Compare output timing configuration by TIMERx_CAR and TIMERx_CHxCV
About the CHxVAL; you can change it ongoing to meet the waveform you expected.
Step5:
Start the counter by CEN.
Figure 14-62. Output-compare in three modes
toggle/set/clear. CAR=0x63, CHxVAL=0x3