Example Code

Use NI-Motion for Generic Encoder RPM Reading

Code and Documents

Attachment

Description:

You can use a PCI- or PXI-73xx motion controller for generic encoder readings, as long as the encoder is not being used for feedback on an axis.

This example demonstrates how to use Read Encoder Position.flx with an extra encoder, and convert the results into the RPM for that encoder. This can be useful if you have an extra encoder in a motion system, where the extra encoder is not being used as primary feeback for an axis.

This VI was created in LabVIEW 2011, with NI-Motion 8.3.

Instructions:

1) Download the "Read extra encoder RPM.vi" attachment

2) Open the Read extra encoder RPM VI

3) Connect an encoder to the encoder inputs for Axis 2 on your UMI

4) In Measurement & Automation Explorer (MAX), go to the Axis Configuration screen for Axis 2, and set the Type of Feedback to "none" (the axis will need to be configured for open-loop stepper)

5) Save, then initialize your motion controller in MAX

6) In the VI front panel, set the Counts/Revolution to the correct value for your encoder

7) Make sure that Encoder 2 is selected in the Axis or Encoder control

😎 Run the VI

9) Rotate the axis that the encoder is connected to, or perform a move that will rotate the encoder. The VI should show you the encoder position as well as the encoder velocity in RPM.

Block Diagram Steps:

1. Initialize an encoder that is not being used for feedback to any axis

2. Read the encoder position and get a millisecond timer value

3. Convert the changes in encoder position and millisecond timer value into RPM

read extra encoder rpm block diagram.png

read extra encoder rpm front panel.png

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
lidartec
Member
Member
on

Why the Encoder Position couldn't return zero while the 7350 receive a encoder index signal?

Contributors