Good idea Jim, I like to see the code too. I am hopping it's not assembly=A0 thanks Andre ________________________________ From: Kerry Wentworth To: Microcontroller discussion list - Public. Sent: Tuesday, October 11, 2011 8:36 AM Subject: Re: [EE] Rotary Encoder Implementation I would like to see the code.=A0 I don't understand from your description. Kerry jim@jpes.com wrote: >=A0 All, > >=A0 I have been working with a rotary encoder that I am planning to use as > a control for a piece of test=20 >=A0 equipment at work.=A0 I have looked on the web for algorithms to decod= e > the outputs of said encoder,=20 >=A0 and have found several.=A0 Most of them work as advertised in my > application, but I have come up with a=20 >=A0 version that works very well in my opinion. > >=A0 I don't know whether it is new or novel, but all I have done is watch > for the "A" output to go high. >=A0 When it does, I then read the port that the encoder is attached to.=A0= I > mask of the bits I am interested=20 >=A0 in, and use this as an index into a table.=A0 If the value is "01" I a= dd > "1" to my variable.=A0 If the value=20 >=A0 is "10", I subtract "1" by adding 255.=A0 Any other combination "00" o= r > "11" adds a zero for no change. > >=A0 I have tried this out spinning the knob on the encoder as fast as I > can, and I can't see any missed=20 >=A0 counts.=A0 I am using a delay of 2.5 mS in my routine for debouncing.= =A0=20 > >=A0 If anyone is interested, I can post the code.=A0 But my guess is I hav= e > just on my own rediscovered an old=20 >=A0 method of decoding rotary encoders. > >=A0=20 >=A0 Regards, > >=A0 Jim > > > >=A0=20 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .