Reading Shaft Encoder Data

Greetings all,
Would anyone out there be able to point me to C code for interpreting the signals from an incremental shaft encoder using quadrature signals? I’m sure someone has done this, but I’m having trouble finding a reference for this and I’d rather not have to re-invent the wheel.

Cheers,
Tim Cole
Ottawa ON

I’m not sure which core you’re using, but if it is Rabbit 3000 based, the R3000.lib Library has the qd_init, qd_read, qd_reset and qd_error functions for performing quadrature decoding. Look in Samples/Rabbit3000 for the QD_Test.c sample for an example of their use. If using Rabbit 4000, these 4 functions have been broken into their own library called QD.lib. The Servo.lib library also can read a quadrature encoder for internal shaft positioning operations, although I can’t remember if you can get to the readings externally.