¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: Encoder switches - trying to get a handle on how to use properly...


 

--- In Electronics_101@..., "lcdpublishing"
<lcdpublishing@...> wrote:

--- In Electronics_101@..., "rtstofer" <rstofer@> wrote:


Should I just count the 24 detent pulses?
OR
Should I count the 96 pulses per revolution?
A link to a datasheet would help...

Richard
This link should take you to the datasheet (I hope)


E/EC12E.PDF
OK, the device has quadrature outputs. This produces 4 transitions
between detents. The reason for quadrature is to provide an
indication of the direction of rotation. On page 194 you will see a
state diagram.

Starting from the left indicated detent location the pattern is: A
goes low then B goes low then A goes high then B goes high.

In the other direction the transitions are: B goes low then A goes low
then B goes high then A goes high.

From the pattern of transitions, direction can be determined.

Among other things, if you build a software state machine to track the
changes, debouncing will be automatic. Sure, you may bobble between A
is high, B is high back and forth with A is low, B is high (or A is
high, B is low) (in other words both sides of the transition) but it
doesn't matter because only one line is changing states - you wont go
from A is high, B is high to A is low, B is low.

You aren't transitioning far enough to upset the count or miss a
detent position. But you can detect the difference between increase
and decrease.

Richard

Join [email protected] to automatically receive all group messages.