A few questions for you Phil, 1) Is your optical encoder detented? (You can feel it click - not a smooth rotation) 2) Are the output from the photodetectors conditioned in any way (i.e. digital), or are they "raw"? The reason I ask, is that depending on the above, entirely different processing is needed. In the mouse biz, the encoders are not detented, and as a result, the mouse can be "parked" at the transition point of the shaft encoders (the photodetectors (darlingtons) drive the uC pins directly). So, jittery or "creeping" cursor motion became a problem in early designs. The way around this was to throw away a valid transition on direction reversal - this is essentially firmware hysteresis . But, in your case, I suspect that you never want to lose a count on direction change in order to isolate noise... John Payson's earlier response in this thread talked about the way to properly deal with mechanical style encoders: "The key is to interpret the encoder as progressing through the states "1X X1 0X X0" rather than the more conventional "11 01 00 10". Since at least one of the two contacts should be stable at any given time, the encoder will always be stable in at least one of the four positions mentioned." He is entirely correct. You might have assumed that this doesn't apply to your case because your encoders are optical. In fact, John's analysis DOES apply to an optical if the encoder is detented. The basic issue here is the fact that the encoder is an opto-mechanical system. The key word being mechanical. With tolerance stack-ups, including die placement in the IR LEDs, Phototransistors or PIN photodiodes, interrupter placement, injection molding tolerances, etc., even a detented positioning system can create a band of uncertainty (+/- angular displacement) so large around the "rest" position of the encoder (stopped in a detent), that if the thing's not designed well, the slot encoder can rest too near the electrical transition region of a detector. This can cause the unwanted "noise" you have indicated. This was a subject I studied in detail while designing mice, and other encoding systems using detented quadrature encoders, both purely mechanical and opto-mechanical. The opto variety are superior, for lots of reasons discussed by myself and others, but it's that darn detent that can in reality be the true Achilles heel, if you are indeed using this kind of a system. I hope this helps shed some light. Chuck Mauro > -----Original Message----- > From: Philip Cowley [SMTP:philc@TOTEM.CO.UK] > Sent: Tuesday, January 27, 1998 6:21 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: Counting encoder pulses > > >Phil, > > > >I would suggest that you don't do the quadrature decoding in the > >PIC, but rather use on of the decoder chips from either Texas or > >Hewlett Packard. > > > I have a little circuit that transforms the quadrature signals into up > and > down pulses (just a pair of NAND gate if memory serves). Then I was > going > to drive the PIC interrupts with these up down (and reset) signals. > > Phil