Clear Buffer

NI-Motion VI

Clear Buffer

Clears the previously configured buffer and clears any associations between resources and the specified buffer.

Details

Device Compatibility

DeviceCompatibility
7330
N
7340
Y
7344
Y
7350
Y
7390
N
NI SoftMotion Controller for CANopen—Accelnet
Y
NI SoftMotion Controller for CANopen—Xenus
Y
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).
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.
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.

Using This VI

After a buffered operation completes, it is important to clear the buffer by calling the Clear Buffer VI. Otherwise, the memory allocated for the buffer in the onboard RAM is not available for other uses, such as the allocation of another buffer or the storage of an onboard program.

A buffer cannot be cleared while it is in use. If you try to clear a buffer while it is in use, the Clear Buffer VI generates a Buffer In Use error.

Note  Configuring and clearing buffers is a processor-intensive operation on the motion controller that requires the allocation and deallocation of memory. You must configure and clear buffers only when motors are not moving and onboard programs are not running. For example, if you wish to execute three simultaneous contouring operations on axis 1, axis 2, and vector space 1 (with axes 3 and 4), you must first configure all three buffers before starting any of the operations. You can start the contour operations independently, and at different times, but wait until all operations are complete before clearing any of the buffers.

Advanced Uses

This VI only clears a buffer from RAM. If you save a buffer to ROM using the Object Memory Management VI, you must delete the buffer from ROM using the Object Memory Management VI. If you call the Clear Buffer VI and specify a buffer that resides in ROM, the association between the resource and the buffer is cleared, but the buffer remains in ROM.

Note  You cannot clear a buffer that is attached to an axis that is moving. You can clear a buffer that is active, such as a high-speed capture buffer that is waiting for a trigger, but NI-Motion returns an error in this case.

If multiple resources refer to the same buffer, all associations from all resources to the specified buffer are cleared. Refer to the Advanced Uses section in the Configure Buffer VI description for more information.

This VI may take longer than 62 ms to process, so it is not guaranteed to be compatible with real-time execution.