A quadrature encoder provides a clock signal and a direction signal and sometimes an index signal (goes high once per revolution). But the clock and direction signals aren’t directly available, they need to be extracted from the two connections. Its operating frequency will be device specific, brainchild might be able to enlighten you with the specifics of his encoder (max RPM expected, pulses per revolution).
From the electrical point of view. From what I understand there are at least two types. Full TTL output, high and low can source and sink equal current. This is the easiest to interface, simply connect it directly to the logic device. And open collector output. This type sometimes has an internal pull up resistor for the high state. If it hasn’t got the pull-up resistor then you’ll need to add one to your interface. Sometimes it’s a good idea to add one in any case, it’ll help with the rise time.
Now to the logic. There are two connections, A and B. to extract the data, clk and direction, you need to look at the wave form:
Click to view attachmentThis is actually called grey code, there is only change in one connection for each pulse.
This is the way I’d envisage its operation in logic:
Reading the encoder On a change of state, invoke an interrupt.
Read the state of A and B.
Compare A and B to the previous states to determine the direction of travel since then.
Add or subtract from the motor total count.
Check index signal and make any adjustments.
Outputting data If the motor total count doesn’t equal the system total count, turn motor in the correct direction.
I’m not too confident that you’ll be able to use a PC directly in the loop. The latencies may be too high to get good results. You may need to consider using a microcontroller to keep track off the motor count and then read this data back into the PC.
DJ