![Geehy SEMICONDUCTOR APM32F405 Series Скачать руководство пользователя страница 177](http://html1.mh-extra.com/html/geehy-semiconductor/apm32f405-series/apm32f405-series_user-manual_573630177.webp)
www.geehy.com Page 176
Forced output mode
In the forced output mode, the comparison result is ignored, and the
corresponding level is directly output according to the configuration instruction.
CCxSEL=00 for TMRx_CCMx register, set CCx channel as output
OCxMOD=100/101 for TMRx_CCMx register, set to force OCxREF
signal to invalid/valid state
In this mode, the corresponding interrupt and DMA request will still be
generated.
Encoder interface mode
The encoder interface mode is equivalent to an external clock with direction
selection. In the encoder interface mode, the content of the timer can always
indicate the position of the encoder.
The selection method of encoder interface is as follows:
By setting SMFSEL bit of TMRx_SMCTRL register, set the counter to
count on the edge of TI1 channel /TI2 channel, or count on the edge
of TI1 and TI2 at the same time.
Select the polarity of TI1 and TI2 by setting the CC1POL and
CC2POL bits of TMRx_CCEN register.
Select to filter or not by setting the IC1F and IC2F bits of
TMRx_CCM1 register.
The two input TI1 and TI2 can be used as the interface of incremental
encoder. The counter is driven by the effective jump of the signals TI1FP1
and TI2FP2 after filtering and edge selection in TI1 and TI2.
The count pulse and direction signal are generated according to the input
signals of TI1 and TI2
The counter will count up/down according to the jumping sequence of
the input signal.
Set CNTDIR of control register TMRx_CTRL1 to be read-only
(CNTDIR will be re-calculated due to jumping of any input end).
The change mechanism of counter count direction is shown in the figure below
Table 63 Relationship between Count Direction and Encoder
Effective edge
Count only in TI1
Count only in TI2
Count in both TI1
and TI2
Level of relative signal
High
Low
High
Low
High
Low
TI1FP1
Rising
edge
—
Count
down
Count up
Count
down
Count up
Falling
edge
Count up
Count
down
Count up
Count
down
TI2FP2
Rising
edge
Count up
Count
down
—
Count up
Count
down