An encoder is a wheel (or linear bar) with marks on it. Usually there are encoders having two marks with a phase difference of 90 deg to one |
|
The two signals (A and B) help to determine the direction of the rotation or movement. When input A leads input B, the value is incremented and when the input B leads input A, the value is decremented.
There are several encoder modes: The first one is used to measure only the rising edges of input A - this is the so called X1 mode. The second mode - X2 measures the rising and falling edges of input A while X4 mode measures rising and falling edges of both signals. X2 and X4 modes are extremely helpful if there is slow movement (for example with linear encoders), because it will actually increase the resolution of measurement by a factor of two or four.
Required hardware |
fully available only on Orion cards, NI-MX supports some modes |
Required software |
Any version |
Setup sample rate |
At least 1 kHz |
If there is a fast dynamic measurement (like torsional vibration) it will sometimes introduce more errors if X2 and X4 mode is used. This is because those two modes assume that the gap ratio is exactly 0.5 and that the encoder electronics switches with exactly the same speed between dark and light areas. We can evaluate this error with period and pulsewidth measurements as described in the next section.
We connect the A signal to SOURCE0, the B signal of the encoder to AUX_CNT0 and the zero pulse to GATE0. Additionally, just for visual presentation, we can also connect those signals to DI_0, DI_1 and DI_2, but there is no need to do this for the measurement.