Incremental Encoder Measurements
- Updated2023-07-12
- 3 minute(s) read
Incremental Encoder Measurements
You can perform position and velocity measurements using incremental encoders with the NI-9361, such as the quadrature and two-pulse encoders.
Quadrature Encoder Overview
A quadrature encoder can have up to three channels: A, B, and Z. When channel A leads channel B in a quadrature cycle, the counter increments. When channel B leads channel A in a quadrature cycle, the counter decrements. The amount of increments and decrements per cycle depends on the type of encoding: X1, X2, or X4.
X1 Encoding
The following figure shows a quadrature cycle and the resulting increments and decrements for X1 encoding. When channel A leads channel B, the increment occurs on the rising edge of channel A. When channel B leads channel A, the decrement occurs on the falling edge of channel A.
X2 Encoding
The counter increments or decrements on each edge of channel A, depending on which channel leads the other. Each cycle results in two increments or decrements, as shown in the following figure.
X4 Encoding
The counter increments or decrements on each edge of channels A and B. Whether the counter increments or decrements depends on which channel leads the other. Each cycle results in four increments or decrements, as shown in the following figure.
Channel Z
Some quadrature encoders have a third channel, channel Z, which is also referred to as the index channel. A high level on channel Z causes the counter to be reloaded with a specified value in a specified phase of the quadrature cycle. Depending on configuration, this reload can occur in any one of the four phases in a quadrature cycle.
Channel Z behavior-when it goes high and how long it stays high-differs with quadrature encoder designs. Refer to the documentation for your quadrature encoder to obtain timing of channel Z with respect to channels A and B. You must then ensure that channel Z is high during at least a portion of the phase you specify for reload.
In the following figure, the reload phase is when both channel A and channel B are low. The reload occurs when this phase is true and channel Z is high. Thus, when channel B goes low to enter the reload phase, the reload occurs. After the reload occurs, the counter continues to count as before. The figure illustrates channel Z reload with X4 decoding.
Two-Pulse Encoder Overview
The counter supports two-pulse encoders that have two channels: A and B. The counter increments on each rising edge of channel A. The counter decrements on each rising edge of channel B, as shown in the following figure.