flex_clear_buffer |
Clear Buffer
Usage
status = flex_clear_buffer(u8 boardID, u8 buffer);
Purpose
Clears the previously configured buffer and clears any associations between resources and the specified buffer.
Parameters
Name | Type | Description |
---|---|---|
boardID | u8 | assigned by Measurement & Automation Explorer (MAX) |
buffer | u8 | buffer to clear |
Parameter Discussion
buffer is the buffer to clear. Valid buffer numbers are 1 through 255 (0x01 through 0xFF).
Using This Function
After a buffered operation is completed, it is important to clear the buffer by calling the Clear Buffer function. 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 the buffer is in use. An NIMC_bufferInUseError is generated in such a case.
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 must wait until all operations are complete before clearing any of the buffers. |
Advanced Uses
This function only clears a buffer from RAM. If you have saved a buffer to ROM using the Object Memory Management function, you must also delete the buffer from ROM using the same function. If you call the Clear Buffer function 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 function description for more information.
This function may take longer than 62 ms to process, so it is not guaranteed to be compatible with real-time execution.