Spehro Pefhany wrote: > > >(BTW, there was a suggestion on the [EE] thread to ignore the 1->0 > >transition on the A channel. Be aware that doing so will reduce your > >resolution by half. Since you are ignoring B channel transitions and >using > >it as only a direction bit, you have already reduced your available > >resolution by half. Depending on your application, this may or may not be >a > >problem.) > >I don't think there is much percentage in double-counting between detents! > Agreed. The whole notion of mechanical detents (and such a limited number of discrete steps) wasn't contained in the original posting. My comments would be much more applicable to an optical encoder with no detents and a much finer resolution than appears to be the case here. >What I usually do is set up a state machine which ignores repeated >transitions >on either input. You have to sample relatively fast, because the motion is >not smooth, it "jumps" between detents, and if you look at the specs for >the phase difference on a typical encoder it is not guaranteed to be >very large... > I completely agree on the use of a state machine but I have to wonder what your definition of a 'typical' encoder is. It would seem that among the different types of encoders available, there is a wide variation in what the specs of a typical encoder would be. The optical encoders that I work with have hundreds of steps per revolution, no detents, and plenty of phase difference between the channels. This application has detents, limited steps, and the phase difference may be open to question. Without being more specific as to the type of encoder, I'm not sure that there really is such a thing as a typical encoder. Regards, Bob _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.