flex_wait_reference

NI-Motion Functions

flex_wait_reference

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

Wait Reference

Usage

status = flex_wait_reference(u8 boardID, u8 axisOrVectorSpace, u16 axisOrVSMap, u32 timeout, u32 pollingInterval, u16* found);

Purpose

Waits for a search sequence initiated by Find Reference to complete and returns the status. Wait Reference also can be used to query the status of a search.

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)
axisOrVectorSpace u8 axis or vector space selector
axisOrVSMap u16 bitmap of axes or vector spaces
timeout u32 timeout in milliseconds
pollingInterval u32 the distance in time between the polling of the find
found u16* returns true if the reference is found

Parameter Discussion

axisOrVectorSpace selects an axis (NIMC_AXIS1 through NIMC_AXIS30), vector space (NIMC_VECTOR_SPACE1 through NIMC_VECTOR_SPACE15), multiple axes (NIMC_AXIS_CTRL), or multiple vector spaces (NIMC_VECTOR_SPACE_CTRL). When simultaneously waiting on multiple axes or vector spaces, the axisOrVSMap parameter indicates which axes or vector spaces are involved. On motion controllers that support fewer than thirty axes, configuring non-existent axes or vector spaces returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to Axes and Vector Spaces for axis and vector space resource IDs.

axisOrVSMap is the bitmap of axes or vector spaces to wait on. It is only required when multiple axes or vector spaces are selected with the axisOrVectorSpace parameter. NI-Motion ignores additional axes and vector spaces if you select non-existent axes.

When starting axes (axisOrVectorSpace = NIMC_AXIS_CTRL):  

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

For D1 through D15:
   1 = Start axis
   0 = Do not start axis

When starting vector spaces (axisOrVectorSpace = NIMC_VECTOR_SPACE_CTRL):

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

For D1 through D15:
   1 = Start vector space
   0 = Do not start vector space

timeout specifies how long, in milliseconds, the Wait Reference call waits before returning. If the timeout is reached before the search completes, the Wait Reference returns. In this manner, Wait Reference can be used to check the status of a search by passing a timeout of 0. By default, the timeout is 4294967295 or 0xFFFFFFFF. This value is handled differently, signifying an infinite wait time.

pollingInterval is the distance in time between the polling of the find reference activity.

found is a returned Boolean value that indicates the success of the find it is waiting for. It does not matter if different finds are being executed on different axes. When all finds are done on all the axes or vector spaces specified, found is true (1) if all of the finds were successful. If any find did not complete successfully, found is false (0).

Using This Function

This function returns when the find on the indicated axes finishes or the timeout is reached, whichever occurs first. There is no need to specify what type of find to wait for because the controller knows what searches are being done on what axes. This function waits for and reports on the success of the current or last executed find on an axis, vector space, or a given set of axes or vector spaces as a whole.

If a Find Reference is being executed with the Run Sequence option, the Wait Reference function does not require an axisOrVectorSpace or axisOrVSMap. When waiting on a Run Sequence, the Wait Reference function returns when the entire sequence has finished. The found Boolean returns True only if all of the operations in the sequence were successful.

Note  You cannot execute any other processes while the Wait Reference function is running. Use Check Reference or Read Reference Status if you want to run other processes simultaneously.

Example

You initiated a Find Home on Axis 1, and Find Center on Axis 2 and Axis 3, and you want to wait for all find sequences to finish before proceeding with the rest of the program. Simply call Wait Reference with the following parameters:

axisOrVectorSpace set to Axis Control (NIMC_AXIS_CTRL)
axisMap set to 00001110 (axis 1, 2, & 3 enabled)

Remarks

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

NI SoftMotion Controller Considerations

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

You cannot execute this function on multiple axes using the NIMC_AXIS_EX_CTRL resource parameter with axes sixteen through thirty.