GD32VF103 User Manual
310
comparison between the output compare register TIMERx_CH2CV and the counter
TIMERx_CNT.
001: Set the channel output. O2CPRE signal is forced high when the counter
matches the output compare register TIMERx_CH2CV.
010: Clear the channel output. O2CPRE signal is forced low when the counter
matches the output compare register TIMERx_CH2CV.
011: Toggle on match. O2CPRE toggles when the counter matches the output
compare register TIMERx_CH2CV.
100: Force low. O2CPRE is forced low level.
101: Force high. O2CPRE is forced high level.
110: PWM mode 0. When counting up, O2CPRE is active as long as the counter is
smaller than TIMERx_CH2CV else inactive. When counting down, O2CPRE is
inactive as long as the counter is larger than TIMERx_CH2CV else active.
111: PWM mode 1. When counting up, O2CPRE is inactive as long as the counter
is smaller than TIMERx_CH2CV else active. When counting down, O2CPRE is
active as long as the counter is larger than TIMERx_CH2CV else inactive.
When configured in PWM mode, the O2CPRE level changes only when the output
compare mode switches from “Timing mode” mode to “PWM” mode or when the
result of the comparison changes.
This bit cannot be modified when PROT [1:0] bit-filed in TIMERx_CCHP register is
11 and CH2MS bit-filed is 00(COMPARE MODE).
3
CH2COMSEN
Channel 2 compare output shadow enable
When this bit is set, the shadow register of TIMERx_CH2CV register, which updates
at each update event will be enabled.
0: Channel 2 output compare shadow disable
1: Channel 2 output compare shadow enable
The PWM mode can be used without validating the shadow register only in single
pulse mode (SPM bit in TIMERx_CTL0 register is set).
This bit cannot be modified when PROT [1:0] bit-filed in TIMERx_CCHP register is
11 and CH0MS bit-filed is 00.
2
CH2COMFEN
Channel 2 output compare fast enable
When this bit is set, the effect of an event on the trigger in input on the
capture/compare output will be accelerated if the channel is configured in PWM1 or
PWM2 mode. The output channel will treat an active edge on the trigger input as a
compare match, and CH2_O is set to the compare level independently from the
result of the comparison.
0: Channel 2 output quickly compare disable. The minimum delay from an edge on
the trigger input to activate CH2_O output is 5 clock cycles.
1: Channel 2 output quickly compare enable. The minimum delay from an edge on
the trigger input to activate CH2_O output is 3 clock cycles.
1:0
CH2MS[1:0]
Channel 2 I/O mode selection
This bit-field specifies the work mode of the channel and the input signal selection.