There are many methods for "decoding" a quad encoder. You may create one, two, or four events per cycle. For a one increment per cycle, you can watch for a rising edge of one input, and the state of the other=20 at that moment will determine the direction. At the other end of the scale, there are four distinct phases (hence "quadrature") of each cycle. By storing the previous 2 bit phase, then comparing it with the=20 current one, there will be four possibilities: No change Increment Decrement error (missed bit) This could be calculated in logic, or by a 16 element lookup table if speed is a primary concern. I have in the past heard some great debates on the "best" way to decode quad inputs. I look forward to seeing how the picsters on this list feel on the subject. Lyle Hazelwood -----Original Message----- From: Erik Jacobs [mailto:emj14@COLUMBIA.EDU] Sent: Wednesday, June 26, 2002 3:11 PM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [EE]: "digital" knobs/buttons > to position. When in one of its stable positions, both sets of contacts > are open, so you can connect multiple encoders in parallel and adjust any > one of them and have the PIC read it fine. I managed to do it with > polling instead of interrupts. On detecting that the first contact had Well, what method did you use to "detect" that the "first" contact was closed? I'm thinking that if I AND the two outputs from the encoder, that could give an interrupt. Then if you just polled until the state changed, you'd see which came up next (either 01 or 10) and that would tell you what direction you're going... yeah? -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads