Read Buffer

NI-Motion VI

Read Buffer

Reads data from a previously configured buffer.

Details

Device Compatibility

DeviceCompatibility
7330
N
7340
Y
7344
Y
7350
Y
7390
N
NI SoftMotion Controller for CANopen—Accelnet
N
NI SoftMotion Controller for CANopen—Xenus
N
Board ID is a unique number assigned by Measurement & Automation Explorer (MAX) used to send and receive commands and data to or from a specific NI motion controller.
Buffer is the buffer to configure. Valid buffer numbers are 1 through 255 (0x01 through 0xFF).
Ret Vect indicates the destination for the return data generated by this VI. Available return vectors include return data to the host (0xFF), return data to a variable (0x01 through 0x78) or variable array (0x81 through 0xF8), and do not return data (0). Refer to Input and Return Vectors for more detailed information.

When returning data to Ret Vect, you must limit Number of Points to a number that fits in a sequence of onboard variables starting with the variable specified by Ret Vect.

error in (no error) describes error conditions that occur before this VI runs. The default input of this cluster is no error. If an error already occurred, this VI returns the value of error in in error out. The VI runs normally only if no incoming error exists. Otherwise, the VI passes the error in value to error out. The error in cluster contains the following parameters:
status is TRUE if an error occurred before this VI was called, or FALSE if not. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code.
code is a number identifying an error or warning. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code. Use the error handler VIs to look up the meaning of this code and display the corresponding error message.
source is a string that indicates the origin of the error, if any. Typically, source is the name of the VI in which the error occurred.
Number of Points (0) is the number of 32-bit data points to read from the buffer.
Bd ID Out is provided for flow control. You can string together NI-Motion VIs by wiring the Bd ID Out terminal of one VI to the Board ID terminal of the next VI.
Buffer Out is provided for flow control. You can string together NI-Motion VIs by wiring the Buffer Out terminal of one VI to the Buffer terminal of the next VI.
error out contains error information. If error in indicates an error, error out contains the same error information. Otherwise, it describes the error status that this VI produces.
status is TRUE if an error occurred, or FALSE if not. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code.
code is a number identifying an error or warning. If status is TRUE, code is a nonzero error code. If status is FALSE, code is zero or a warning code. Use the error handler VIs to look up the meaning of this code and display the corresponding error message.
source is a string that indicates the origin of the error, if any. Typically, source is the name of the VI in which the error occurred.
Data is the destination array for data read from the buffer.

Using This VI

An input buffer can be written to after it has been configured, usually by an onboard program. After data is available, you read the data from the buffer with the Read Buffer VI.

When the buffer is configured for a single iteration, you can wait until the buffer is full by checking its status using the Check Buffer VI, and then read the entire contents of the buffer. You also can read smaller chunks of data from the buffer while the operation is in progress. The number of points available to read can be determined with the Backlog parameter returned by Check Buffer.

When using the buffer as a circular buffer (Total Points > Buffer Size) with Old Data Stop turned on, you must read data from the buffer faster than the buffer is filled with new data. You can determine the number of points you can safely read from the buffer by calling the Check Buffer VI.

The Backlog parameter tells you how many points you can safely read from the buffer.

If you try to read data that has not yet been written to the buffer by the controller, the data is not read, and the controller generates an Old Data Stop error. If you configure the buffer with Old Data Stop set to false, however, you can read data freely from the buffer, and the controller does not enforce the Old Data Stop condition.

Read Buffer generates an illegal buffer operation error if you try to read data from an output buffer after the specified number of points (Total Points) has already been read from the buffer.