flex_read_buffer_rtn |
Read Buffer Return
Usage
status = flex_read_buffer_rtn(u8 boardID, u8 buffer, u32 numberOfPoints, i32* data);
Purpose
Reads data from a previously configured buffer.
Parameters
Name | Type | Description |
---|---|---|
boardID | u8 | assigned by Measurement & Automation Explorer (MAX) |
buffer | u8 | buffer to read |
numberOfPoints | u32 | number of data points to read from the buffer |
data | i32* | destination array for data read from the buffer |
Parameter Discussion
buffer is the buffer to read from. Valid buffer numbers are 1 through 255 (0x01 through 0xFF). numberOfPoints is the number of 32-bit data points to read from the buffer.
data is the destination array for data read from the buffer.
Using This Function
An input buffer can be written to after it has been configured, usually by an onboard program. After data is available to read, you read the data from the buffer with this function.
When the buffer is configured for a single iteration, you can wait until the buffer is full by checking the status of the buffer with the Check Buffer function, and then read the entire contents of the buffer. You also can read the 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 the Check Buffer function.
When using the buffer as a circular buffer (totalPoints > bufferSize), with oldDataStop turned on, you need to read data from the buffer faster than the buffer is being filled with new data. You can determine the number of points you can safely read from the buffer by calling the Check Buffer function. The backlog parameter indicates 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 NIMC_oldDataStopError. However, if you configured the buffer with oldDataStop set to false, you can read data freely from the buffer, and the controller does not enforce the oldDataStop condition.
Under no circumstances can data be read from an output buffer (for example, contouring) after the specified number of points (totalPoints) has already been read from the buffer. An NIMC_illegalBufferOperation error is generated in this case.