Does your encoder have explicit detents? If so, I think that each detent is usually one count, not 4. Note that encoders have a number of lines per rev and a number of counts per rev. For a quadrature encoder, # of counts =3D 4* # of lines. I have only worked with one encoder which had explicit detents and it was implemented so that there was 1 count per detent (i.e., 4 detents per line). It was a 32 line/rev encoder but there were 128 detents per rev. Sean On Sun, Sep 6, 2009 at 1:21 AM, Josh Koffman wrote: > On Sun, Sep 6, 2009 at 12:10 AM, Terry Harris wro= te: >> The code in the document counts all edges. There are 4 edges for a 'puls= e' >> on one channel. Are you sure you are not misunderstanding the datasheet >> (and actually have a problem when you only get 3 counts?). > > AHA! I think you have hit the nail on the head Terry. The encoders I'm > currently using have a tiny bit of wobble so it's possible that > occasionally they're missing a step and that's how I get 3 counts. For > the most part it's pretty rock solid at 4 counts, and if I turn the > encoder slowly and carefully I can get it to do single steps (mostly - > sometimes there's a bit of jitter). > > So...is there a standard way to deal with this? If I want one click to > be one event, should I just do a counter or is there more elegant code > that I'm just not thinking of? > > Thanks! > > Josh > -- > A common mistake that people make when trying to design something > completely foolproof is to underestimate the ingenuity of complete > fools. > =A0 =A0 =A0 =A0-Douglas Adams > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist