Thank you Richard,
Could you take a moment to describe what happens with edge detection on both channels?
Sincere thanks!
dw
Thank you Richard,
Could you take a moment to describe what happens with edge detection on both channels?
Sincere thanks!
dw
every edge [transition] is a decodable step for the encoder
you catch each step with an edge triggered pin interrupt, you need a better chip , 16f1825 or something useful
Warning I'm not a teacher
We had a similar discussion not that long ago, might be worth revisiting.
It's important to remember that one usually want to do more than JUST keep track of an enocder and that has to be accounted for. Anyway, here's a link to that thread: http://www.picbasic.co.uk/forum/show...ght=quadrature
Thank you Hendrik.
That gave me a lot to think about.
One of the examples in that thread has the pic checking for 4 possible conditions of two bits, and remembering the last condition of those two bits.
With my experiments so far - I haven't found that to be necessary in order to maintain accuracy.
I have a pic that simulates the output of an encoder, starting with pulse periods of 15ms.
It produces 180 cycles in the CW direction - then pauses - and then produces 180 cycles in the CCW direction.
After each CW/CCW process - it starts over - but with a little shorter pulse period.
I then monitor my programs decoder output on an LCD display.
If all goes well - it starts at 0 - goes to 180 counts and then returns to 0.
I know when the processor is starting to loose track when the LCD displays bad numbers.
So far I've been able to accurately track pulse periods down to 5milli-seconds.
That may in fact be satisfactory for my usage - but I'm still playing with other options.
Richard - thank you for pointing me to that PIC!!!
I was going to ask about newer PICs with internal OSC running at higher speeds
But I hadn't even imagined one running at 32Mhz
Very sweet!!
And thank you for the emphasizing catching each edge with an ONCHANGE interrupt.
I'll be doing some further research on that - especially with a faster device!
Sincere thanks :-]
Bookmarks