User`s guide

44 Agilent VISA User’s Guide
3 Programming with VISA
Using Non-Formatted I/O
There are two non-buffered, non-formatted I/O functions that
synchronously transfer data called viRead and viWrite. Also, there are
two non-formatted I/O functions that asynchronously transfer data
called viReadAsync and viWriteAsync. These are raw I/O functions
and do not intermix with the formatted I/O functions.
Non-Formatted I/O Functions
The non-formatted I/O functions follow. For more information, see the
viRead, viWrite, viReadAsync, viWriteAsync, and viTerminate
functions in the VISA Online Help.
viRead. The viRead function synchronously reads raw data from the
session specified by the vi parameter and stores the results in the
location where buf is pointing. Only one synchronous read operation
can occur at any one time.
viRead(vi, buf, count, retCount);
viWrite. The viWrite function synchronously sends the data pointed
to by buf to the device specified by vi. Only one synchronous write
operation can occur at any one time.
viWrite(vi, buf, count, retCount);
Refer to the Agilent VISA help file for specific infomraiton on these
and other VISA functions such as viReadAsync
and viWriteAsync.
Example: Using Non-Formatted I/O Functions This sample
program illustrates using non-formatted I/O functions to communicate
with a GPIB device. This example program is intended to show specific
VISA functionality and does not include error trapping. Error trapping,
however, is good programming practice and is recommended in your
VISA applications. See “Trapping Errors” in this chapter for more
information.