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

NI-VISA

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

VISA uses two basic output buffers: the formatted I/O write buffer and low-level I/O transmit buffer. The formatted I/O write buffer holds the converted and formatted parameters (as the format string specifies) before sending the formatted data to the device, as shown in Figure 1. viPrintf and its variants (for example, viBufWrite and viQueryf) are the only operations that use the formatted I/O write buffer.

The advantage of using formatted I/O buffers for data to be written to a device is that if you are sending multiple small formatted strings in several programmatic commands, you can batch them and have VISA send them in a single transfer; this eliminates repeating the first-byte latency overhead. On the other hand, if you do not need VISA to format or buffer your data, you can send it directly to the device from the user's data buffer using viWrite and its variants (for example, viWriteAsync), as shown in Figure 2.

The VISA specification defines the low-level I/O transmit buffer, but it is rarely used in practice. Its main purpose is to provide logical parallelism. Therefore, except in the case of serial resources, the low-level I/O transmit buffer is not needed, and data is sent directly to the device, as shown in Figure 2. For more information about using the low-level I/O transmit buffer with serial resources, refer to Controlling the Serial I/O Buffers.

Related Topics

Automatically Flushing the Formatted I/O Buffers

Controlling the Serial I/O Buffers

Formatted I/O Read and Low-Level I/O Receive 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

viPrintf

viSetBuf