Just what kind of encoder are we talking about here? Do you really need a 7-bit absolute position encoder? A 2-bit incremental one would use less pins. And be cheaper. What's the application? Will it be turning rapidly or not? I've been given a PIC-based hi-fi front panel to program. It uses a 2-bit encoder to control volume and balance. They are not as simple as they look. They don't have the nice clean squarewaves shown in textbooks. Maybe the optical ones do, but the mechanical ones have contact bounce. Cost dictates the use of mechanical encoders. De-bouncing by software is not as easy as pushbuttons. The data sheet says the bounce time is about 1 to 3 ms. There are 96 phases per revolution. If you rotate it at the maximum specified by the data sheet (say one turn per second), each phase lasts 1/96 seconds i.e. 10.4 milliseconds. So you need to detect valid states that can last as short as twice the bounce time! With hindsight, I reckon the proper thing to do is have an RC filter (time constant around 3 milliseconds) followed by two Schmitt triggers to sharpen the edges for the PIC. Many PIC inputs are Schmitts, so they may be able to cope. It's too late to change the circuit now, so I'm having to just sample them every millisecond or so and do a bit of digital filtering. If the same state appears 3 or 4 times, its assumed to be valid. Also note that if you have "clicky" ones, as I do, they may reduce the number of settings per turn. For example, the ones I have have one click per four phases (24 clicks per turn). The rotor naturally settles into the clicked phase. So if you have an electronic attenuator with 127 steps, it takes nearly five turns to ramp through the lot, instead of one and a third. IMHO, clicky ones are appropriate for controlling parameters that have discrete steps (like TV or audio channel selection). Smooth ones are appropriate for controlling parameters that have don't (like volume, balance etc.)