Well, these encoders are spec'd with <5mS chatter or bounce. I don't want to process a change, then poll again, finding a change that really is the same one with the contacts still not settled and bouncing between 0 and 1. Therefore I tried a debounce delay after detecting a change, and after the delay checking if the same change is still there. After all the feedback from you all good people, I will now try to process after first sign of change, then delay for next polling. Jan Didden ----- Original Message ----- From: "Jeff DeMaagd" To: Sent: Sunday, July 22, 2001 7:39 PM Subject: Re: [PIC]: Stumped by rotary encoder > Is this a mechanical encoder? Really long signal lines? I don't understand > why you are having to deal with bounces. The encoders I've used had clean > outputs. > > Jeff > > ----- Original Message ----- > From: SkinTech > > > [sorry, send at first without tag. therefore resend] > > Hi all, > > I always try to solve my own problems (I learn from it) but this one has me > stumped. > My project has a 16F74, reading the output of a rotary encoder (2 bit), see > below. > First I check by polling if there is a change in the 'A' bit. If so, I wait > some 10mS (debounce) and then look again. If there is still a change, I > check if it is 1>0 or 0>1. In each case, I then check the 'B' bit to > determine direction. For debugging I beep once (CW) or twice (CCW) the > buzzer. > When turning the encoder I get seemingly random results. Sometimes it beeps > 3 times, or 4 times, or 1 time, or not at all over half a revolution. Then > it starts again. I'm pretty sure it has to do with the debounce, but I can't > get it right. I must add that the beep adds another 10 or 30 mS delay > between pollings. > The encoders are spec'd at <5mS chatter. > > Has anyone experience with decoding rotary encoders? Any help or ideas would > be greatly appreciated. > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.