You are of course correct. This is my error. Better code: if B and not SaveB then if A is high then increment the controlled value else decrement the controlled value endif Set SaveB to B It is really that simple (now that I got it right). Bob Ammerman RAm Systems ----- Original Message ----- From: "Hazelwood Lyle" To: Sent: Wednesday, June 26, 2002 4:05 PM Subject: Re: [EE]: "digital" knobs/buttons Bob, I respectfully disagree, or perhaps I'm just woefully confused. If you look for ANY change in B, either rising or falling, then the pseudo-code you provided will "wiggle" back and forth between increment and decrement, as the input is turned in a constant direction. Unless you differentiate between "B Rising" and "B Falling", the state of A will move you back and forth. Now, if Either B rising OR B Falling inverts A before the test, you'll have one method of doing the two step per cycle option that I failed to cover in my previous letter. I could be all wrong.. I am open to hear more. Please elucidate. I sketched up a chart to follow the changes, I'll head home and pic up the thread from there. P.S. I didn't start this thread, but I'll be ordering a few encoders this week to upgrade a project from pots, so I am quite interested to see where it goes. Lyle Hazelwood -----Original Message----- From: Bob Ammerman [mailto:rammerman@ADELPHIA.NET] Sent: Wednesday, June 26, 2002 3:45 PM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [EE]: "digital" knobs/buttons I would just poll the inputs in a fixed-time based interrupt routine. For normal manual rotation you'd have no trouble keeping up. Assume the two inputs are called A and B. We have a value called and 'SaveB' On each interrupt: if B <> SaveB then if A is high then increment the controlled value else decrement the controlled value Set B to SaveB endif It is really that simple. Bob Ammerman RAm Systems -- 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 -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads