
GD32A50x User Manual
341
Figure 18-17. Output-compare under three modes
shows the three compare modes:
toggle/set/clear. CARL=0x63, CHxVAL=0x3.
Figure 18-17. Output-compare under three modes
CEN
CNT_REG
00
01
02
03
04
05
…
.
62
63
Overflow
match toggle
CNT_CLK
OxCPRE
00
01
02
03
04
05
…
.
62
63
01
02
03
04
05
…
.
00
match set
match clear
OxCPRE
OxCPRE
Output PWM function
In the PWM output function (by
setting the CHxCOMCTL/ MCHxCOMCTL bit to 3’b110 (PWM
mode 0) or to 3’b 111(PWM mode 1)), the channel can generate PWM waveform according
to the TIMERx_CAR registers and TIMERx_CHxCV/ TIMERx_MCHxCV registers.
Based on the counter mode, PWM can also be divided into EAPWM (Edge-aligned PWM)
and CAPWM (Center-aligned PWM).
The
EAPWM’s period is determined by TIMERx_CAR and the duty cycle is determined by
TIMERx_CHxCV/
output and interrupts waveform.
The
CAPWM’s period is determined by 2*TIMERx_CAR, and the duty cycle is determined by
2*TIMERx_CHxCV/ TIMERx_MCHxCV.
CAPWM output and interrupts waveform.
In up counting mode, if the value of TIMERx_CHxCV/ TIMERx_MCHxCV is greater than the
value of TIMERx_CAR, the output will be always inactive in PWM mode 0 (CHxCOMCTL/
MCHxCOMCTL =3’b110). And if the value of TIMERx_CHxCV/ TIMERx_MCHxCV is greater
than the value of TIMERx_CAR, the output will be always active in PWM mode 1
(CHxCOMCTL/ MCHxCOMCTL =3’b111).