> From: "Jeff 'n Kristen Kroll" > > I have been reading the PICLIST for about a month and have seen several > methods of doing quadrature decoding on a PIC. One method, the one in the > Microchip Applications Handbook suggests monitoring one channel and when it > changes check the other channel to determine direction. Doesn't this reduce > the resolution of the encoder by half? This method would be great if it > didn't because the project I am working on, a six degree of freedom > trackball, needs to monitor three encoders, and the 16c65 chip I'm using > only has four interrupt on change pins. However I can't sacrifice > resolution. > BTW, I just wanted to comment on how impressed I am at the helpfulness(?) > of everyone on the PICLIST. Keep up the good work! You can feed both quadrature inputs into an XOR gate and apply the XOR gate output to the interrupt-on-change pin. The output makes a transition on each edge of either input. You can look at the XOR gate output and one of the 'raw' inputs to determine direction info. BTW, just in case you are under a misapprehension, one degree of freedom counts both the forward and reverse directions as the one DOF. If you truly have a 6-DOF trackball, my mind is boggling trying to imagine how one would drive such a beast, since you would need X, Y and Z translation, plus pitch, roll and yaw! -- and 6 encoders, not 3. Strap yourself in for a slight digression: did you know that you can yaw (spin) a trackball using just pitch and roll? To demonstrate this, take a ball and sit it on a table. Put your hand on the top of the ball. You can pitch the ball by moving your hand back and forth, and you can roll it using side to side motion. Now if you move your hand in small circles, the ball yaws in the opposite direction to your hand motion (albeit with some nutation). Mathematicians will tell you that this is a result of group theory, but I think it just works anyway in spite of that lot... Regards, SJH Canberra, Australia