Jerry said:
Good. There must be chips that do this, but It is easily done with
hardware or with interrupt-driven software. Do you want a display, an
updated variable in a computer, or both? Whatever you do, there can be
mis-counts unless the shaft locations are exactly the same when counting
up and counting down. The up- and down-count angles differ In
excessively simple implementations, and that leads to trouble.
"Solutions should be as simple as possible, but not simpler."
Jerry
Email me, I'll give you a PDF file that shows the use of 2 D-Ff with
a clear Function that can generate the up/down pulse just from the
A and B outputs only.
I don't have ASCII text options here to post something so I'll wing it.
Assume 2 D-FF's, 1FF and 2FF
On each FF, the Data input and CLR function pin are tied together.
(A) encoder signal is connected to the Clk(clock) of 1FF as well to
the Data/CLR pin function of 2FF.
(B) encoder signal is connected to the CLK(clock) of 2FF as well to
the Data/CLR pin function of 1FF.
The Q output of each D-ff forms the Pulse.
Q of 1FF will Pulse going CW.
Q of 2FF will Pulse going CCW.
These Pulses can be used to inc/dec a counter somewhere to indicate
position.
We use this circuit via a A/B encoder to determine the direction
and speed with a large accumulator system to govern forward speed
and direction of detection. The decoded signal then gets past into a
simple F/V converter to generate an analog signal proportional to the
speed of movement only on the forward direction for a drive using analog
biasing.
Happy benching.
http://webpages.charter.net/jamie_5"