cancel
Showing results for 
Search instead for 
Did you mean: 

Changing counting direction on encoder interface

orkunkasapoglu
Associate II
Posted on March 01, 2013 at 15:57

Hi all. I want to measure length between 2 pressure pistons but I don't know can i change the directon with changing IC1 edge align mode or IC2 edge align mode on x4 resolution mode for example

1-) TIM_EncoderInterfaceConfig(TIM2, TIM_EncoderMode_TI12, TIM_ICPolarityRising, TIM_ICPolarityRising);

2-)TIM_EncoderInterfaceConfig(TIM2, TIM_EncoderMode_TI12, TIM_ICPolarityFalling, TIM_ICPolarityRising);  or  TIM_EncoderInterfaceConfig(TIM2, TIM_EncoderMode_TI12, TIM_ICPolarityRising, TIM_ICPolarityFalling);

while first selection is counting up/down,can one of second selection count down/up??

if this is not useful how can i change directon during the encoder timer is counting??
2 REPLIES 2
Posted on March 01, 2013 at 16:11

May be you can diagram the system/signals so those not familiar with it might be able to suggest possible solutions?

The TIM units are pretty complex, and often inflexible. Several aspects can't be changed on the fly, which might mean you need to briefly disable to effect change.

Also be aware that each TIM unit has a SINGULAR counting element, and 4 latches.

Where possible you want the hardware to latch a timebase, and then compute the delta between measurements.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
orkunkasapoglu
Associate II
Posted on March 08, 2013 at 13:02

yes i can measure the delta but i think i can do it with hardware when the timers count different ways i can change the channel 1 to 2 with a circuit. i'll try the both of these thank you clive1