Set Stepper Loop Mode

NI-Motion VI

Set Stepper Loop Mode

Sets a stepper axis to operate in either open-loop, closed-loop, or P-Command mode.

Details

Device Compatibility

DeviceCompatibility
7330
Y
7340
Y
7344
Y
7350
Y
7390
Y
NI SoftMotion Controller for CANopen—Accelnet
N
NI SoftMotion Controller for CANopen—Xenus
N
Loop Mode (Open) sets the mode for the stepper axis.
Board ID is a unique number assigned by Measurement & Automation Explorer (MAX) used to send and receive commands and data to or from a specific NI motion controller.
Axis is the axis for which to load PID parameters. Valid axis numbers are 1 through 15 for all NI motion controllers. On controllers with less than eight axes, configuring non-existent axes has no effect.
error in (no error) describes error conditions that occur before this VI runs. The default input of this cluster is no error. If an error already occurred, this VI returns the value of error in in error out. The VI runs normally only if no incoming error exists. Otherwise, the VI passes the error in value to error out. The error in cluster contains the following parameters:
status is TRUE if an error occurred before this VI was called, or FALSE if not. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code.
code is a number identifying an error or warning. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code. Use the error handler VIs to look up the meaning of this code and display the corresponding error message.
source is a string that indicates the origin of the error, if any. Typically, source is the name of the VI in which the error occurred.
Bd ID Out is provided for flow control. You can string together NI-Motion VIs by wiring the Bd ID Out terminal of one VI to the Board ID terminal of the next VI.
Resource Output is the Axis, Vector Space, ADC, or Encoder you wired into the VI. Use Resource Output to pass the resource to another VI and/or to display information about the device.
error out contains error information. If error in indicates an error, error out contains the same error information. Otherwise, it describes the error status that this VI produces.
status is TRUE if an error occurred, or FALSE if not. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code.
code is a number identifying an error or warning. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code. Use the error handler VIs to look up the meaning of this code and display the corresponding error message.
source is a string that indicates the origin of the error, if any. Typically, source is the name of the VI in which the error occurred.

Using This VI

You can operate stepper axes in both open and closed-loop modes. In open-loop mode, the stepper axis controls the trajectory profile and generates steps but has no feedback from the motor or actuator to determine if the profile is followed correctly.

In closed-loop mode, the feedback position is constantly compared to the number of steps generated to see if the stepper motor is moving correctly. When the trajectory profile is complete, missing steps (if any) are made up with a pull-in move. If, at any time during the move, the difference between the instantaneous commanded position and the feedback position exceeds the programmed following error limit, the axis is killed and motion stops.

You use P-Command mode for systems in which a servo drive receives step/dir (CW/CCW) from the motion controller. The drive closes the PID loop, and the motion controller generates the trajectory. Similar to closed-loop mode, in P-Command mode, the axis is killed when the programmed following error limit is exceeded.

Caution  For proper closed-loop and P-Command operation, the correct values for steps/rev and counts/rev must be loaded with the Load Counts/Steps per Revolution VI. Incorrect counts to steps ratio can result in failure to reach the target position and erroneous closed-loop stepper operation.

To operate in closed-loop or P-Command mode, a stepper axis must have a primary feedback resource, such as an encoder, mapped to it prior to enabling the axis. Refer to the Configure Axis Resources VI for more information about feedback resources. You can operate an axis with a primary feedback resource in open-loop, closed-loop, or P-Command mode and you can switch the mode at any time. You can still read the position of the mapped feedback resource even when the axis is in open-loop mode.