Table 95. Counting Direction Versus Encoder Signals - ST STM32F412 Reference Manual

Advanced arm-based 32-bit mcus
Table of Contents

Advertisement

RM0402
TIMx_ARR must be configured before starting. In the same way, the capture, compare,
prescaler, repetition counter, trigger output features continue to work as normal. Encoder
mode and External clock mode 2 are not compatible and must not be selected together.
In this mode, the counter is modified automatically following the speed and the direction of
the incremental encoder and its content, therefore, always represents the encoder's
position. The count direction correspond to the rotation direction of the connected sensor.
Table 95
same time.
Active edge
Counting on
TI1 only
Counting on
TI2 only
Counting on
TI1 and TI2
An external incremental encoder can be connected directly to the MCU without external
interface logic. However, comparators are normally be used to convert the encoder's
differential outputs to digital signals. This greatly increases noise immunity. The third
encoder output which indicate the mechanical zero position, may be connected to an
external interrupt input and trigger a counter reset.
Figure 118
direction control. It also shows how input jitter is compensated where both edges are
selected. This might occur if the sensor is positioned near to one of the switching points. For
this example we assume that the configuration is the following:
CC1S='01' (TIMx_CCMR1 register, TI1FP1 mapped on TI1).
CC2S='01' (TIMx_CCMR2 register, TI1FP2 mapped on TI2).
CC1P='0', CC1NP='0', and IC1F = '0000' (TIMx_CCER register, TI1FP1 non-inverted,
TI1FP1=TI1).
CC2P='0', CC2NP='0', and IC2F = '0000' (TIMx_CCER register, TI1FP2 non-inverted,
TI1FP2= TI2).
SMS='011' (TIMx_SMCR register, both inputs are active on both rising and falling
edges).
CEN='1' (TIMx_CR1 register, Counter enabled).
summarizes the possible combinations, assuming TI1 and TI2 do not switch at the

Table 95. Counting direction versus encoder signals

Level on opposite signal
(TI1FP1 for TI2,
TI2FP2 for TI1)
High
Low
High
Low
High
Low
gives an example of counter operation, showing count signal generation and
Advanced-control timers (TIM1&TIM8)
TI1FP1 signal
Rising
Down
Up
No Count
No Count
Down
Up
RM0402 Rev 6
TI2FP2 signal
Falling
Rising
Up
No Count
Down
No Count
No Count
Up
No Count
Down
Up
Up
Down
Down
Falling
No Count
No Count
Down
Up
Down
Up
449/1163
483

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F412 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF