GD32F20x User Manual
399
The PWM mode 0 and PWM mode 1 outputs are also another kind of OxCPRE output which
is setup by setting 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. With regard to a more detail description refer to the
relative bit definition.
Another special function of the OxCPRE signal is a forced output which can be achieved by
setting the CHxCOMCTL field to 0x04/0x05. Here the output can be forced to an
inactive/active level irrespective of the comparison condition between the counter and the
TIMERx_CHxCV values.
The OxCPRE signal can be forced to 0 when the ETIFE signal is derived from the external
ETI pin and when it is set to a high level by setting the CHxCOMCEN bit to 1 in the
TIMERx_CHCTL0 register. The OxCPRE signal will not return to its active level until the next
update event occurs.
Quadrature decoder
The quadrature decoder function uses two quadrature inputs CI0 and CI1 derived from the
TIMERx_CH0 and TIMERx_CH1 pins respectively to interact to generate the counter value.
The DIR bit is modified by hardware automatically during each input source transition. The
input source can be either CI0 only, CI1 only or both CI0 and CI1, the selection made by
setting the SMC [2:0] to 0x01, 0x02 or 0x03. The mechanism for changing the counter
direction is shown in the following table. The quadrature decoder can be regarded as an
external clock with a directional selection. This means that the counter counts continuously
in the interval between 0 and the counter-reload value. Therefore, users must configure the
TIMERx_CAR register before the counter starts to count.
Table 18-5. Counting direction versus encoder signals
Counting
mode
Level
CI0FE0
CI1FE1
Rising
Falling
Rising
Falling
CI0 only
counting
CI1FE1=High
Down
Up
-
-
CI1FE1=Low
Up
Down
-
-
CI1 only
counting
CI0FE0=High
-
-
Up
Down
CI0FE0=Low
-
-
Down
Up
CI0 and CI1
counting
CI1FE1=High
Down
Up
X
X
CI1FE1=Low
Up
Down
X
X
CI0FE0=High
X
X
Up
Down
CI0FE0=Low
X
X
Down
Up
Note:
"-" means "no counting"; "X" means impossible.
Summary of Contents for GD32F20 Series
Page 191: ...GD32F20x User Manual 191 Bits Fields Descriptions 31 0 TRNDATA 31 0 32 Bit Random data ...
Page 290: ...GD32F20x User Manual 290 conversion is ongoing ...
Page 325: ...GD32F20x User Manual 325 15 0 ALRM 15 0 RTC alarm value low ...
Page 385: ...GD32F20x User Manual 385 ...
Page 523: ...GD32F20x User Manual 523 clears AERR bit by writing 0 to it ...