flex_read_axis_limit_status

NI-Motion Functions

flex_read_axis_limit_status

Device Compatibility

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

Read Axis Limit Status

Usage

status = flex_read_axis_limit_status(u8 boardID, u16 limitType, u8 returnVector);

Purpose

Reads the instantaneous state of either the hardware limit inputs or the software limits.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
limitType u16 hardware/software limit selector
returnVector u8 destination for the return data

Parameter Discussion

limitType selects the type of limit status to read, either the hardware limit switch status or the software position limit status.

limitType Constant limitType Value
NIMC_LIMIT_INPUTS 0
NIMC_SOFTWARE_LIMITS 1

returnVector contains the reverse limits and forward limits, which are returned in one onboard variable: 0000 000F FFFF FFF0 0000 000R RRRR RRR0.

Available return vectors include return data to the host (0xFF), to a variable (0x01 through 0x78), to an indirect variable (0x81 through 0xF8), and return no data (0). Refer to Input and Return Vectors for more detailed information.

Note  The suffix _rtn on the function indicates that the data must be returned to the host. When this calling convention is used, no returnVector is required.

Using This Function

This function returns either the hardware limit input status or the software position limit status, depending on the limit type selected. When limitType = NIMC_LIMIT_INPUTS (0), this function returns the logical state of the forward and reverse limit inputs.

Note  The polarity of the limit inputs determines if an On state is active high or active low. Refer to the Set Limit Input Polarity function for more information.

Alternatively, when limitType = NIMC_SOFTWARE_LIMITS (1), this function returns the state of the forward and reverse software limits. A True (On) indicates that the forward or reverse limit position for the corresponding axis has been reached or exceeded. The limit input status during a Find Reference move is undefined.

You can read the status of the limit inputs and the software position limits at any time, regardless of if the limits are enabled. Enabled limits cause axes to stop when their state transitions True. Refer to the Enable Axis Limits function for more information.