cancel
Showing results for 
Search instead for 
Did you mean: 

up down counter with TIMx

utelettronico
Associate II
Posted on October 10, 2008 at 05:11

up down counter with TIMx

2 REPLIES 2
utelettronico
Associate II
Posted on May 17, 2011 at 12:39

Hi,

I'm developing a two channel application that require to increment a value if a impulse is received on a channel and decrement it if it is received on the other channel.

Is it possible to use the TIMx interface to work like an up-down counter?

It seems that the encoder interface and the external clock source mode X don't allow this. Any idea?

Thanks

utelettronico

utelettronico
Associate II
Posted on May 17, 2011 at 12:39

I resolved this issue using a channel as external clock and the other one as interrupt input that changes the TIMx direction bit.

I think the Encoder Mode 1 and 2 are completely useless. These configurations simply halve the counting of an incremental encoder. So you still need two signals in quadrature, but differently from Encoder Mode 3 the counter is incremented only on the rising/falling edge of one channel, the other one is used only to avoid glitch.

Thank you