# Reading Shaft Encoder Data

**URL:** <https://forums.digi.com/t/reading-shaft-encoder-data/10900>\
**Category:** Rabbit\
**Created:** [March 25, 2008, 2:23am UTC](https://forums.digi.com/t/reading-shaft-encoder-data/10900 "2008-03-25T02:23:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimCole](https://avatars.discourse-cdn.com/v4/letter/t/eb9ed0/32.png) [@TimCole](https://forums.digi.com/u/TimCole)\
**Post date:** [March 25, 2008, 2:23am UTC](https://forums.digi.com/t/reading-shaft-encoder-data/10900/1 "2008-03-25T02:23:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bsprouse](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@bsprouse](https://forums.digi.com/u/bsprouse)\
**Post date:** [April 16, 2008, 11:22pm UTC](https://forums.digi.com/t/reading-shaft-encoder-data/10900/2 "2008-04-16T23:22:33Z")

</div>

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.
