![GigaDevice Semiconductor GD32A50 Series Скачать руководство пользователя страница 432](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32a50-series/gd32a50-series_user-manual_2225782432.webp)
GD32A50x User Manual
432
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
can be forced to 0 when the ETIFP signal derived from the external ETI pin is set to a high
level. 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
CI0FE0 and CI1FE1 derived
from the TIMERx_CH0 and TIMERx_CH1 pins respectively to interact with each other to
generate the counter value. Setting SMC=0x01, 0x02, or 0x03 to select that the counting
direction of timer is determined only by the
CI0FE0, only by the CI1FE1, or by the CI0FE0
and the
CI1FE1. The DIR bit is modified during the voltage level change of each direction
selection source. The mechanism of changing the counter direction is shown in
Counting direction in different quadrature decoder mode
. The quadrature decoder can
be regarded as an external clock with a direction selection. This means that the counter
counts continuously from 0 to the counter-reload value. Therefore, users must configure the
TIMERx_CAR register before the counter starts to count.
Table 18-7. Counting direction in different quadrature decoder mode
Counting mode
Level
CI0FE0
CI1FE1
Rising Falling
Rising Falling
Quadrature decoder mode 0
SMC[2:0]=3’b001
CI1FE1=1
Down
Up
-
-
CI1FE1=0
Up
Down
-
-
Quadrature decoder mode 1
SMC [2:0]=3’b010
CI0FE0=1
-
-
Up
Down
CI0FE0=0
-
-
Down
Up
Quadrature decoder mode 2
SMC [2:0]=3’b011
CI1FE1=1
Down
Up
X
X
CI1FE1=0
Up
Down
X
X
CI0FE0=1
X
X
Up
Down
CI0FE0=0
X
X
Down
Up
Note:
"-
" means "no counting"; "X" means impossible. ”0” means “low level”, ”1” means “high level”.