![GigaDevice Semiconductor GD32E23 Series Скачать руководство пользователя страница 395](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794395.webp)
GD32E23x User Manual
395
Output PWM function
In the output PWM function
(by setting the CHxCOMCTL bits to 3’b110 (PWM mode0) or to
3’b 111(PWM mode1), the channel can generate PWM waveform according to the
TIMERx_CAR registers and TIMERx_CHxCV registers.
The period is determined by TIMERx_CAR and duty cycle is determined by TIMERx_CHxCV.
Figure 14-79. PWM mode timechart
shows the PWM output mode and interrupts
waveform.
If TIMERx_CHxCV is greater than TIMERx_CAR, the output will be always active under
P
WM mode0 (CHxCOMCTL==3’b110).
And if TIMERx_CHxCV is equal to zero, the output will be always inactive under PWM
mode0 (CHxCOMCTL==3’b110).
Figure 14-79. PWM mode timechart
0
CHxVAL
CAR
PWM MODE0
PWM MODE1
Cx OUT
Cx OUT
Interrupt signal
CHxIF
CHxOF
Channel output prepare signal
When the TIMERx is used in the compare match output mode, the OxCPRE signal (Channel
x Output prepare signal) is defined by setting the CHxCOMCTL filed. The OxCPRE signal
has several types of output function. These include, keeping the original level by setting the
CHxCOMCTL field to 0x00, set to 1 by setting the CHxCOMCTL field to 0x01, set to 0 by
setting the CHxCOMCTL field to 0x02 or signal toggle by setting the CHxCOMCTL field to
0x03 when the counter value matches the content of the TIMERx_CHxCV register.
The PWM mode 0 and PWM mode 1 outputs are also another kind of OxCPRE output which
is setup by setting the CHxCOMCTL field to 0x06/0x07. In these modes, the OxCPRE signal
level is changed according to the counting direction and the relationship between the counter
value and the TIMERx_CHxCV content. With regard to a more detail description refer to the