cancel
Showing results for 
Search instead for 
Did you mean: 

Timer Encoder Mode Oddities

shingadaddy
Senior
Posted on July 05, 2016 at 23:03

Well if you have stared at the data sheet and user manual like I have for a bit and tried to get an encoder running ''understandably'' / ''predictably'', you might hit some slippery curves. Don't underestimate the curves the ENCODER ITSELF can throw in. the encoder I had picked for me was a nice cheap quadrature encoder by Bourns.

ECW1D-C24-CC0024L .

I was half expecting that this was the usual encoder output. It has 24 click/detents per revolution and I figured 1 edged change per click. Repeating a quadrature cycle 6 times in 360 degrees.

   < WRONG >

I get 1 FULL QUADRATURE CYCLE per click. YES PER CLICK!....

So if things go weird - first make sure your encoder does what you expect.

Sheeesh...

I'm still fumbling around with the timer setting to see if I can get a count of 1 per click out of the TIMER counts (TIMx->CNT) but short of a manual coding of a single right bump ( little endian) I haven't found it yet.

Suggestions?

#encoder
3 REPLIES 3
Posted on July 05, 2016 at 23:09

Input prescaler?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
shingadaddy
Senior
Posted on July 05, 2016 at 23:16

Hi clive!

I think that works if you use a *real* clock of some sort for timer input. But encoder?? --- I'll give it another go but pretty sure I tried it.. Back in a minute

shingadaddy
Senior
Posted on July 05, 2016 at 23:30

Ah! Thanks clive1. That worked! And of course -

That was embarrassing. Heres how THAT went.

Original observation - 2 counts per click

Added a manual code *bump to the right* to make sure that took care of the 2 counts to 1 count. (Success!)

Messed with prescaler....

I'm sure you can see the curve I made for myself there...

Thanks again!