On Sat, 5 Sep 2009 19:54:32 -0400, you wrote: >Hi all. I've been working on a new project using mechanical rotary >encoders. I wrote a new encoder reading routine based on the info I >found in this document: >http://www.tufts.edu/programs/mma/emid/RotaryEncoder.pdf. The method >is to compare the LSB of the current reading to the MSB of the last >reading, XOR them together, and from there you will be able to >determine an up or down motion. > >It works quite well. A bit too well in fact... > >For each movement of the encoder I'm getting too many events in my >code. From my understanding of the datasheet it should be one detent = >one pulse. For each detent I currently get about 4 events. The code in the document counts all edges. There are 4 edges for a 'pulse' on one channel. Are you sure you are not misunderstanding the datasheet (and actually have a problem when you only get 3 counts?). -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist