On Sat, Sep 5, 2009 at 8:10 PM, Bob Axtell wrote: > There are a few tricks to using quad encoders. > > The main problem is that mechanical encoders can be noisy when they > are turned, or the lines from the encoder can be corrupted by ESD, AC > hum, line noise. The way to solve these issues is to sample 5 times > and accept the data change only after the data is stable; to verify > that it is stable, read it at least 5 times in a row, and all five > captures must have the same result. Using a PIC makes this easy. > > --Bob No, I have an optical encoder, and if you turn it carefully by hand, you can find a position where one channel will randomly oscillate. Continuously. No amount of debouncing will fix this. Rather, decode the Gray code, and add a step or two of hysteresis after it if you want to suppress this noise. But be aware that you are trading off precision to do so, like an old car with slop in the steering wheel. Regards, Mark markrages@gmail -- Mark Rages, Engineer Midwest Telecine LLC markrages@midwesttelecine.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist