
GD32L23x User Manual
306
Figure 17-13. Timing chart of CAPWM
0
CHxVAL
CAR
PWM MODE0
Cx OUT
PWM MODE1
Cx OUT
Interrupt signal
CHxIF
CHxOF
CAM=2'b01 down only
CAM=2'b10 up only
CHxIF
CHxOF
CAM=2'b11 up/down
CHxIF
CHxOF
Channel output prepare signal
As is shown in
Figure 17-10. Output compare logic (x=0,1,2,3)
, when TIMERx is configured
in compare match output mode,a middle signal which is OxCPRE signal (Channel x output
prepare signal) will be generated before the channel outputs signal. The OxCPRE signal type
is defined by configuring the CHxCOMCTL bit. The OxCPRE signal has several types of
output function. These include keeping the original level by configuring the CHxCOMCTL field
to 0x00, setting to high by configuring the CHxCOMCTL field to 0x01, setting to low by
configuring the CHxCOMCTL field to 0x02 or toggling signal by configuring the CHxCOMCTL
field to 0x03 when the counter value matches the content of the TIMERx_CHxCV register.
The PWM mode 0/PWM mode 1 output is another output type of OxCPRE which is setup by
configuring 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. Refer to the definition of relative bit for more details.
Another special function of the OxCPRE signal is a forced output which can be achieved by
configuring the CHxCOMCTL field to 0x04/0x05. The output can be forced to an
inactive/active level irrespective of the comparison condition between the values of the
counter and the TIMERx_CHxCV.
Configure the CHxCOMCEN bit to 1 in the TIMERx_CHCTL0 register, the OxCPRE signal