>
> JB wrote:
>
> > Just looking for a little advice on how to detect (in a way that would trigger an interrupt) the transition of multiple quadrature encoders. For simplicity, let's say I have an X & Y axis I'm monitoring. I could hook the X-axis 'A' line to the PIC's external INT pin, and the 'B' line to another input pin. Thus, when X changes, I get an interrupt from the 'A' transition, and I can then look at the 'B' line to determine direction of travel.
> >
> > How then would I add the Y-axis encoder in such a way that I could also detect state changes via interrupt as I can on the X-axis?
>
> The problem with the interrupt on one line and monitoring the other is you are only able to detect 1/4 of the information available since each transition (high or low) on either line is 'movement and direction' information.
> If you could set up the interrupt pin to detect both high going or low going you would still only be able to detect half of the transitions.
> The approach I would recommend (there are others) is to poll both inputs for a change, by comparing with the last stored poll result, if the previous results dont match what you have now there has been a movement and which pin changed to what level will tell you which direction you moved ( a few if-then type decisions will yield the desired results).
> This method can be expanded to incorporate multiple encoder inputs.
> Except for slow encoders or simple processing applications I often use a separate (cheap) microcontroller for this application.
>
> Lance Allen
> Embedded Systems Lab
> CSE
> Electronic and Electrical Engineering
> School of Engineering
> University of Auckland
>
> --
>
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
> email
.....listservKILLspam
.....mitvma.mit.edu with SET PICList DIGEST in the body