I have forgotten to say, in my previuos post, that the code snippet is not a quadrature count, and it counts only channel A, while Channel B is used only for direction. So total count per encoder turn will be n/2.
To get a quadrature count you need to detect the rising and falling edges of the square waves, thing that is not possible with the pic you have in use. To obtain the quadrature count you either need additional external logic or you have to choose a pic with the quadrature counter. (Much easier)
Al.
Last edited by aratti; - 31st August 2009 at 06:42.
All progress began with an idea
Bookmarks