09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>RM0090</strong> General-purpose timers (TIM2 to TIM5)<br />

selected. This might occur if the sensor is positioned near to one of the switching points. For<br />

this example we assume that the configuration is the following:<br />

● CC1S= ‘01’ (TIMx_CCMR1 register, TI1FP1 mapped on TI1)<br />

● CC2S= ‘01’ (TIMx_CCMR2 register, TI2FP2 mapped on TI2)<br />

● CC1P= ‘0’, CC1NP = ‘0’, IC1F =’0000’ (TIMx_CCER register, TI1FP1 noninverted,<br />

TI1FP1=TI1)<br />

● CC2P= ‘0’, CC2NP = ‘0’, IC2F =’0000’ (TIMx_CCER register, TI2FP2 noninverted,<br />

TI2FP2=TI2)<br />

● SMS= ‘011’ (TIMx_SMCR register, both inputs are active on both rising and falling<br />

edges)<br />

● CEN = 1 (TIMx_CR1 register, Counter is enabled)<br />

Figure 153. Example of counter operation in encoder interface mode<br />

TI1<br />

TI2<br />

Counter<br />

forward jitter backward<br />

jitter<br />

forward<br />

up down up<br />

Figure 154 gives an example of counter behavior when TI1FP1 polarity is inverted (same<br />

configuration as above except CC1P=1).<br />

Figure 154. Example of encoder interface mode with TI1FP1 polarity inverted<br />

TI1<br />

TI2<br />

Counter<br />

forward jitter backward<br />

jitter<br />

forward<br />

down<br />

up<br />

down<br />

The timer, when configured in Encoder Interface mode provides information on the sensor’s<br />

current position. You can obtain dynamic information (speed, acceleration, deceleration) by<br />

measuring the period between two encoder events using a second timer configured in<br />

Doc ID 018909 Rev 3 444/1416

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!