> Philip Cowley wrote: > > > I need to count the pulses coming from a pair > > of quadrature incremental encoders. > > Are these optical encoders, or mechanical? > The latter have _awful_ signals. While I agree that mechanical encoders' signals leave something to be desired, they need not cause too many problems. 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. For some types of software implementation, this method will be equivalent to adding one click worth of hysteresis to the processing logic. The interpretation of the signal as having those "X" states, however, will allow for other implementations which would not be feasible otherwise. For example, on a chip with two independently-programmable edge-detect interrupts, the interrupts could be programmed so that each rotational click would cause one interrupt [for example, if I'm looking for and see a rising edge on the first input, I would check the state of the second input and then disable the first input's interrupt-on-change while I enabled the second's]. Mechanical encoders can be tricky to be sure, and the 4-bit ones may be easier to get good results with than the 2-bit ones; still, the availa- bility of many cheap mice that work decently proves that even junky 2 bit encoders can be made to work reliably.