Rotary encoder: 4 counts per click?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Rotary encoder: 4 counts per click?

Post by MJU »

Am I missing something? Probably I do :D

I've made a simple Flowchart with a GLCD and a rotary encoder.
The encoder triggers an interrupt and if the "check for change" macro doesn't return 255 the counter is read.

But each click gives me an increace or decrease of 4...
I've tried several changes for the encoder (fast/medium/slow) but this error is persistent.

What am I doing wrong?
Thanks

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Rotary encoder: 4 counts per click?

Post by Benj »

Hello,

I've experienced this.

For each click of the encoder it travels through 4 states hence the output count of 4. Not sure why but it's normal.

Simply divide the number by 4 (or right shift the value by 2 for efficiency) to collect the click count.

alanwms
Posts: 67
Joined: Tue Sep 16, 2008 2:09 pm
Location: Minnesota USA
Has thanked: 4 times
Been thanked: 17 times
Contact:

Re: Rotary encoder: 4 counts per click?

Post by alanwms »

The reason it is called a "quad" encoder, is because it counts the state change of each edge. Since there are 4 edges per cycle, that would equate to 4 counts per "count".
Your encoder is probably mechanically indented creating the sine and cosine signal. For a no indented encoder (such as on a motor) it would be possible to count a single edge.
The advantage of this is that the encoder resolution for a 200 count/rev encoder would be 800 counts per revolution. Creating better resolution

Hope this throws some light on the subject.

Post Reply