GD32F403xx User Manual
352
About the CHxVAL, you can change it on the go to meet the waveform you expected.
Step5:
Start the counter by CEN.
The timechart below show the three compare modes toggle/set/clear. CAR=0x63,
CHxVAL=0x3
Figure 16-51. Output-compare under three modes
CEN
CNT_REG
00
01
02
03
04
05
…
.
62
63
Overf low
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 output PWM function
(by setting the CHxCOMCTL bits to 3’b110 (PWM mode0) or to
3’b 111(PWM mode1), the channel can outputs PWM waveform according to the
TIMERx_CAR registers and TIMERx_CHxCV registers.
Based on the counter mode, we have can also divide PWM into EAPWM (Edge aligned PWM)
and CAPWM (Centre aligned PWM).
The EAPWM period is determined by TIMERx_CAR and duty cycle is by TIMERx_CHxCV.
shows the EAPWM output and interrupts waveform.
The CAPWM period is determined by 2*TIMERx_CAR, and duty cycle is determined by
interrupt waveform.
If TIMERx_CHxCV is greater than TIMERx_CAR, the output will be always active under PWM