Measuring Position with an Angular Encoder

NI DAQ Assistant

Measuring Position with an Angular Encoder

On devices that use the NI-TIO timing chip, you can use the counters to perform position measurements with encoders. An encoder is a device that converts linear or rotary displacement into digital or pulse signals. Angular position can be measured with X1, X2, and X4 quadrature encoders. You can choose to do either single-point (on-demand) position measurement or buffered (sample clock) position measurement.

The counter measures the position of the encoder using the A and B signals, which are offset by 90°. The NI-TIO counters also support the Z index, which provides a precise reference point and is available on some quadrature encoders.

To configure a measurement, you specify the initial sensor position through the Initial Angle attribute/property, depending on your encoder type. You also can specify if the Z Input Terminal is used with the Z Index Enable attribute/property. The reload position upon a Z index signal, as well as when a Z index position should cause a reload to occur in relation to the A and B signals are also configurable through the Z Index Phase and Z Index Value attributes/properties, respectively.

When performing an on-demand position measurement, you first call the Start VI/function to arm the counter. Each subsequent read returns the current position of the encoder. If you perform multiple reads without first starting the counter, the counter implicitly starts and stops with each Read function/VI call, and the position is not recorded properly between read calls.

When doing buffered position measurement, the current position is latched on each active edge of the sample clock and stored in the buffer. There is no onboard clock for buffered position measurement, so you must supply an external sample clock.