Actually, interrupt on change is just about the only way to make quad encoding work. Set the PIC up to capture a change on both the A and the B pins. When you get into the routine, immediately read repeatedly until you get 3-5 SAME results on BOTH A and B. The XOR with old state, etc as is needed. I think you will see things clear up. --Bob On Sat, Sep 5, 2009 at 5:58 PM, Josh Koffman wrote: > On Sat, Sep 5, 2009 at 8:36 PM, Ray wrote: >> Josh, >> I was doing 4 quadrant decoding of a rotary encoder on a motor back in t= he 70's >> The problem is when the encoder rests on an edge instead of off 45 degre= es. >> On an edge the dithering =A0of +1/-1 can be very high frequency in X4 mo= de. >> that means you need to do interrupt on edge (plus & minus) of both chann= els. >> I would guess that is the mode you are in. >> That give you the most steps per revolution. >> X2 is easier and X1 more so if you do not mind less steps per revolution= s. >> >> 3x means you are not keeping up with changes. >> >> I could draw you a logic drawing for X1/X2/X4 that you can convert to lo= gic. >> Or a truth table. >> Let me know. > > Hi Ray, > > I think I sort of understand what you're getting at. I'm not 100% sure > how it applies to me though. My data sheet shows that at each detent > my B channel should be transitioning. I'm not sure interrupt on change > is a possibility in my situation. > > So...I guess what I'm saying is that I'm confused. Help! > > By the way, my current thought is to try feeding the port with my > encoders on it through my debounce routine to see what happens if I > verify all the current states. My only concern is that this might not > be fast enough to capture a quickly moving knob (which isn't that > quick, these are user controls, not on a motor). I'd still like to > know for sure why this is happening though. > > Thanks! > > Josh > -- > A common mistake that people make when trying to design something > completely foolproof is to underestimate the ingenuity of complete > fools. > =A0 =A0 =A0 =A0-Douglas Adams > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist