Input and Return Vectors

NI-Motion Functions

Input and Return Vectors

Many functions that load values and virtually all readback functions support vectoring. Load functions, for example Load Target Position, take an input vector that specifies the source of the data, either immediate (within the function call), from a general-purpose onboard variable, or from an indirect variable. Read functions, for example Read Position, take a return vector that specifies the destination for the returned data, either the host computer, an onboard variable, or an indirect variable.

The ability to use variables in motion control functions is one of the powerful features of the NI-Motion onboard programming environment. You can read data from a resource into a variable, scale or perform some other calculation on the value, and then load the new value as a trajectory or other motion parameter. All data operations functions take data from variables and return the result through a return vector, typically to another variable.

NoteĀ  Data returned to the host by a return vector of 0xFF is actually left in the Return Data Buffer (RDB). Read data from the RDB using Read Return Data Buffer.

In addition to specifying a variable directly, you can use indirect variables to reference a variable indirectly, much like a pointer in C. Refer to Onboard Variables for more information.

Input and return vectors are very useful when writing onboard programs but have little or no use in programs running on the host computer. For this reason, the default value for input vector is immediate (0xFF) and the API includes a second _rtn version for all Read functions. This version automatically retrieves the data from the RDB after requesting it and returns it by reference to the output parameter.

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

The return vector must be 0xFF for 7330 and 7390 controllers, because they do not support onboard programming.

Refer to Communication between the Host Computer and the NI-Motion Controller for information about the RDB.