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. I've written the manufacturer of the encoder just to double check, but I'm guessing the problem lies in my work somewhere. I'm currently in Brazil so I don't have access to my scope or analyzer so I can't verify if I'm actually getting more pulses than I should be. Is it possible I'm getting contact bounce on the encoder and my code is reading those as turns? What's interesting is that it's almost always 4 events. I call the routine in a timer trigger interrupt, and I've played with the values just to see what would happen. I expected that the number of extra events would change, but it seems to always be 4. Occasionally it's 3, but only rarely. Does anyone have any suggestions on what might be going on and how I might be able to fix it? Thanks! Josh -- A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist