flex_load_sw_lim_pos

NI-Motion Functions

flex_load_sw_lim_pos

Device Compatibility

Device Compatibility
7330
Y
7340
Y
7344
Y
7350
Y
7390
Y
NI SoftMotion Controller for CANopen—Xenus
Y
NI SoftMotion Controller for CANopen—Accelnet
Y

Load Software Limit Positions

Usage

status = flex_load_sw_lim_pos(u8 boardID, u8 axis, i32 forwardLimit, i32 reverseLimit, u8 inputVector);

Purpose

Loads the forward and reverse software limit positions for an axis.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
axis u8 axis to control
forwardLimit i32 forward software limit position in counts or steps
reverseLimit i32 reverse software limit position in counts or steps
inputVector u8 source of the data for this function

Parameter Discussion

axis is the axis to control. Valid values are NIMC_AXIS1 through NIMC_AXIS30. On motion controllers that support fewer than thirty axes, configuring non-existent axes returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to Axes for axis resource IDs.

forwardLimit is the forward software limit position in counts (servo axes) or steps (stepper axes). Software limit positions can be anywhere within the 32-bit position range, –(231) to +(231–1). The default value for the forward software limit is +(230–1) counts (steps).

reverseLimit is the reverse software limit position in counts (servo axes) or steps (stepper axes). Software limit positions can be anywhere within the 32-bit position range, –(231) to +231–1). The default value for the reverse software limit is –230 counts (steps).

Note  forwardLimit cannot be less than reverseLimit.

inputVector indicates the source of the data for this function. Available input vectors include immediate (0xFF), variable (0x01 through 0x78), or indirect variable (0x81 through 0xF8). Refer to Input and Return Vectors for more detailed information.

Using This Function

This function sets the forward and reverse position limit values for the selected axis. When enabled with the Enable Axis Limits function, a software limit causes the axis to smoothly decelerate to a stop when the limit position is reached or exceeded.

Even when disabled, you can poll the software limits by the host computer or use an onboard program to warn of an out of range position. Refer to the Read Axis Limit Status function for information about reading the software limit status.

The forward software limit is considered active if the current position is greater than or equal to the forward software limit position. The reverse software limit is considered active if the current position is less than or equal to the reverse software limit position.

Software limits are often used to restrict the range of travel and avoid hitting the hardware end-of-travel limit switches. For example, you can travel at a high velocity until hitting the software limit switch, and then move more slowly until hitting the hardware limit switch.

Caution  After an axis has stopped due to encountering a software limit switch, you can still move further in the same direction if you command the axis to do so. This behavior is not possible with hardware limits, but is appropriate for software limits.