Formatted I/O Read and Low-Level I/O Receive Buffers

NI-VISA

Formatted I/O Read and Low-Level I/O Receive Buffers

VISA uses two basic input buffers: the formatted I/O read buffer and low-level I/O receive buffer. The formatted I/O read buffer eliminates the first-byte latency overhead that would exist if VISA performed its formatting algorithms by retrieving data from the device one byte at a time. Instead, VISA transfers a block of data from the device to the formatted I/O read buffer. VISA then performs its formatting algorithms on the raw data in the formatted I/O read buffer and places the formatted data into the user buffer, as shown in Figure 1. viScanf and its variants (for example, viBufRead and viQueryf) are the only operations that use the formatted I/O read buffer.

The low-level I/O receive buffer avoids data loss with resources that push or stream their response data to the host PC. Serial INSTR and TCPIP Socket are two examples of this type of resource. viRead and its variants (for example, viReadAsync) transfer data from the low-level I/O receive buffer into the user buffer in this scenario, as shown in Figure 2.

In contrast, when VISA must request data from a resource (such as GPIB INSTR), a call to viRead (or one of its variants) transfers data from the device directly into the user buffer, as shown in Figure 3.

The only time when both the formatted I/O read buffer and low-level I/O receive buffer are used is when viScanf is called on a resource that pushes data to the host PC (such as Serial INSTR or TCPIP Socket), as shown in Figure 4.

Related Topics

Automatically Flushing the Formatted I/O Buffers

Controlling the Serial I/O Buffers

Formatted I/O Write and Low-Level I/O Transmit Buffers

Manually Flushing the Formatted I/O Buffers

Recommendations for Using the VISA Buffers

VI_ATTR_RD_BUF_OPER_MODE

VI_ATTR_WR_BUF_OPER_MODE

viFlush

viScanf

viSetBuf