![ARTERY AT32F435 Series Скачать руководство пользователя страница 259](http://html1.mh-extra.com/html/artery/at32f435-series/at32f435-series_reference-manual_2977592259.webp)
AT32F435/437
Series Reference Manual
2022.11.11
Page 259
Rev 2.03
−
Enable counter through the TMREN bit in the TMRx_CTRL1 register
Table 14-4 Counting direction versus encoder signals
Active edge
Level on opposite signal
(C1INFP1 to C2IN, C2INFP2
to C1IN)
C1INFP1 signal
C2INFP2 signal
Rising
Falling
Rising
Falling
Count on C1IN only
High
Down
Up
No count
No count
Low
Up
Down
No count
No count
Count on C2IN only
High
No count
No count
Up
Down
Low
No count
No count
Down
Up
Count on both C1IN and
C2IN
High
Down
Up
Up
Down
Low
Up
Down
Down
Up
Figure 14-21 Example of counter behavior in encoder interface mode (encoder mode C)
20
21
22
23
24
25
26
27
26
25
24
23
22
21
20
1F
COUNTER
0x3
TWCMSEL
[1:0]
CI1RAW
CI2RAW
UP
DOWN
14.2.3.3 TMR input function
Each of TMR2~TMR5 timers has four independent channels, with each channel being configured as
input or output.
As input, each channel input signal is handled as follows:
−
TMRx_CHx outputs the pre-processed CxIRAW. The C1INSEL bit is used to select the source of
C1IRAW from TMRx_CH1 or the XOR-ed TMRx_CH1, TMRx_CH2 and TMRx_CH3. The sources
of C2IRAW, C3IRAW and C4IRAW are TMRx_CH2, TMRx_CH3 and TMRx_CH4, respectively.
−
CxIRAW inputs digital filter and outputs filtered CxIF signal. The digital filter uses the CxDF bit to
program sampling frequency and sampling times.
−
CxIF inputs edge detector, and outputs the CxIFPx signal after edge selection. The edge selection
depends on both CxP and CxCP bits. It is possible to select input rising edge, falling edge or both
edges.
−
CxIFPx inputs capture signal selector, and outputs the CxIN signal after capture signal selection.
The capture signal selection is defined by CxC bit . It is possible to select CxIFPx, CyIFPx or STCI
as CxIN source. Of those, CyIFPx (x
≠
y) is the CyIFPy signal that is from Y channel and processed
by channel -x edge detector (for example, C1IFP2 is the channel 1
’
s C1IFP1 signal that passed
through channel 2 edge detection). The STCI comes from slave timer controller, and its source is
selected by STIS bit.
−
CxIN outputs the CxIPS signal that is divided by input channel divider. The divider factor can be
defined as No division, /2, /4 or /8, by the CxIDIV bit . It can be used for filtering, selection, division
and input capture of input signals.