flex_enable_axis_limit

NI-Motion Functions

flex_enable_axis_limit

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

Enable Axis Limits

Usage

status = flex_enable_axis_limit(u8 boardID, u16 limitType, u16 forwardLimitMap, u16 reverseLimitMap);

Purpose

Enables/disables either the forward and reverse limit inputs or the forward and reverse software position limits.

Tip  Refer to the Remarks section for information about how the behavior of this function differs between controllers.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
limitType u16 hardware/software limit selector
forwardLimitMap u16 bitmap of forward limits to enable
reverseLimitMap u16 bitmap of reverse limits to enable

Parameter Discussion

limitType selects the type of limit to enable, either the hardware limit switch inputs or the software position limits:

limitType Constant limitType Value
NIMC_LIMIT_INPUTS  0
NIMC_SOFTWARE_LIMITS  1

forwardLimitMap is the bitmap of forward limits to enable (either inputs or software):

D15 ... D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
Forward 15 ... Forward 10 Forward 9 Forward 8 Forward 7 Forward 6 Forward 5 Forward 4 Forward 3 Forward 2 Forward 1 0

For D1 through D15:
   1 = Forward limit enabled
   0 = Forward limit disabled (default)

reverseLimitMap is the bitmap of reverse limits to enable (either inputs or software).

D15 ... D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
Reverse 15 ... Reverse 10 Reverse 9 Reverse 8 Reverse 7 Reverse 6 Reverse 5 Reverse 4 Reverse 3 Reverse 2 Reverse 1 0

For D1 through D15:
   1 = Reverse limit enabled
   0 = Reverse limit disabled (default)

Using This Function

This function enables/disables any combination of axis limits. You can enable the physical limit inputs (hardware) or the logical position limits (software) depending upon the limitType selected. You can enable or disable forward and reverse limits separately. To enable both software and hardware limits on an axis or axes, call this function twice.

The limit inputs are typically connected to end-of-travel limit switches or sensors. An enabled limit input causes a halt stop on the axis when the input becomes active. You can configure each limit input to active low or active high with the Set Limit Input Polarity function. Active limit inputs also prohibit attempts to start motion that would cause additional travel in the direction of the limit. You also can use limit inputs as general-purpose inputs and read their status with the Read Axis Limit Status function.

Note  For the end-of-travel limits to function correctly, the forward limit switch or sensor must be located at the positive (count up) end of travel and the reverse limit at the negative (count down) end of travel.

Similarly, software limits are often used to restrict the range of travel further and avoid ever hitting the hardware limit switches. An enabled software limit causes the axis to smoothly decelerate to a stop when the limit position is reached or exceeded. To enable the software limits, you must first find the reference point using the Find Reference function.

Even when disabled, you can use the host computer to poll the software limits to warn of an out of range position. Refer to the Load Software Limit Positions and the Read Limit Status functions for information about loading and reading the forward and reverse software limits.

Hardware limit inputs and software position limits are enhancements on the NI motion controllers and are not required for basic motion control. You can operate all motion control functions without enabling or using these limits except the Find Reference function, which requires enabled limit and home inputs for operation. Find Reference does not require enabled software limits. Refer to the following functions for more information about enabling home inputs: Set Home Input Polarity, Enable Home Inputs, and Read Home Input Status.

Example

To enable the forward and reverse software limits on axes 1 and 3, and disable the forward and reverse software limits on the remaining axes, call the Enable Limits function with the following parameters:

limitType = NIMC_SOFTWARE_LIMITS

forwardLimitMap = 0x0A, which corresponds to the following bitmap:

D15 ... D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
Forward 15 ... Forward 10 Forward 9 Forward 8 Forward 7 Forward 6 Forward 5 Forward 4 Forward 3 Forward 2 Forward 1 0
0 ... 0 0 0 0 0 0 0 1 0 1 0

reverseLimitMap = 0x0A, which corresponds to the following bitmap:

D15 ... D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
Reverse 15 ... Reverse 10 Reverse 9 Reverse 8 Reverse 7 Reverse 6 Reverse 5 Reverse 4 Reverse 3 Reverse 2 Reverse 1 0
0 ... 0 0 0 0 0 0 0 1 0 1 0

This example affects only the software limits, because the limitType parameter is set to NIMC_SOFTWARE_LIMITS (1). To affect the hardware limits, set limitType to NIMC_HARDWARE_LIMITS (0).

Remarks

This section includes information about how the behavior of this function differs among the controllers that support it.

NI 73xx Controller Considerations

The following list includes considerations you must make when you are using this function with a 73xx motion controller:

  • An active (and enabled) limit input transition on an axis that is part of a vector space move causes that axis to halt stop and the other axes in the vector space to decelerate to a stop.
  • If any axis in a vector space move exceeds an enabled software limit position, all axes in the vector space decelerate to a stop.

NI SoftMotion Controller Considerations

The following list includes considerations you must make when you are using this function with the NI SoftMotion Controller:

  • An active (and enabled) limit on an axis that is part of a vector space causes all of the axes in the vector space to halt stop.
  • To enable limits on axes sixteen through thirty, use the Write Motion I/O Data function.