From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Programmatically Set Parameters of Reference Move Using NI Motion

Introduction

In a closed loop setting, NI Motion uses feedback from an encoder or other source to determine position. However, this information is useless unless the motor starts from a known location. This can often be the case when a motion system first starts up. This idea of an unknown starting location is also true while working with open loop systems.

To account for this fact and to put the motor in a known location, you can use reference moves (which use limit and home switches) to move the axes to a known starting location and orientation. In order to perform this move, there are several parameters that need to be set. These parameters can be set in Measurement & Automation Explorer (MAX) under the Find Reference Settings tab for the axes being configured.

These settings can also be configured in code using a series of Load Reference Parameter.flx VIs. This example demonstrates how to programmatically set reference move parameters and perform a reference move.

Steps to Complete

- Open the attached VI

- Select the appropriate Board ID and Axis

- Toggle the 'Manually Configure?' switch to either use settings set in MAX or to use settings configured in code

- Adjust reference move parameters to appropriate settings for your application

- Use Detailed Help for Load Reference Parameter.flx for help setting parameters

- Use the NI Motion Help (Start»All Programs»National Instruments»NI Motion»Documentation»NI Motion Help) for more information on how each parameter will affect final reference move

- Once that parameters are set, run the VI

- Notice how the limit switches affect motion.

- Change parameters and see how it changes the overall move profile

Additional Notes

This example was originally written in LabVIEW 2009 using NI Motion 8.1.

reference.png

Hope this helps.
-Ben

WaterlooLabs

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

Comments
JTRACKER
Member
Member
on

Attachment?

Contributors