GD32A50x User Manual
343
If CHxCOMCTL = 3’b111 (PWM mode 1) and DIR = 1’b0 (up counting mode), or
CHxCOMCTL = 3’b110 (PWM mode 0) and DIR = 1’b1 (down counting mode) the channel x
output is forced high when the counter matches the value of CHxVAL. It is forced low when
the counter matches the value of CHxCOMVAL_ADD.
The PWM period is determined by (CARL + 0x0001) and the PWM pulse width is determined
by the
Table 18-3.The Composite PWM pulse width
Table 18-3.The Composite PWM pulse width
Condition
Mode
PWM pulse width
CHxVAL < CHxCOMVAL_ADD
≤ CARL
PWM mode 0
(CARL + 0x0001) +
(CHxVAL
– CHxCOMVAL_ADD)
PWM mode 1
(CHxCOMVAL_ADD
– CHxVAL)
CHxCOMVAL_ADD < CHxVAL
≤ CARL
PWM mode 0
(CHxVAL - CHxCOMVAL_ADD)
PWM mode 1
(CARL + 0x0001) +
(CHxCOMVAL_ADD
– CHxVAL)
(CHxVAL = CHxCOMVAL_ADD ≤
CARL) or
(CHxVAL > CARL
> CHxCOMVAL_ADD)
PWM mode 0 (up
counting) or
PWM mode 1 (down
counting)
100%
PWM mode 0 (down
counting) or
PWM mode 1 (up
counting)
0%
CHxCOMVAL_ADD > CARL >
CHxVAL
PWM mode 0(up
counting) or
PWM mode 1(down
counting)
0%
PWM mode 0(down
counting) or
PWM mode 1(up
counting)
100%
(CHxVAL>CARL)and
(CHxCOMVAL_ADD > CARL)
-
The output of CHx_O is keeping
When the counter reaches the value of CHxVAL, the CHxIF bit is set and the channel x
interrupt is generated if CHxIE = 1, and the DMA request will be asserted, if CHxDEN=1.
When the counter reaches the value of CHxCOMVAL_ADD, the CHxCOMADDIF bit is set
(this flag just used in composite PWM mode, when CHxCPWMEN=1) and the channel x
additional compare interrupt is generated if CHxCOMADDIE = 1 (Only interrupt is generated,
no DMA request is generated).
According to the relationship among CHxVAL, CHxCOMVAL_ADD and CARL, it can be
divided into four situations:
1)
CHxVAL < CHxCOMVAL_ADD, and the values of CHxVAL and CHxCOMVAL_ADD