User`s guide

40 Agilent VISA User’s Guide
3 Programming with VISA
Sending I/O Commands
This section provides guidelines for sending I/O commands, including:
Types of I/O
Using Formatted I/O
Using Non-Formatted I/O
Types of I/O
Once you have established a communications session with a device, you
can start communicating with that device using VISA's I/O routines.
VISA provides both formatted and non-formatted I/O routines.
Formatted I/O converts mixed types of data under the control of a
format string. The data is buffered, thus optimizing interface traffic.
Non-formatted I/O sends or receives raw data to or from a device.
With non-formatted I/O, no format or conversion of the data is
performed. Thus, if formatted data is required, it must be done by the
user.
You can choose between VISA's formatted and non-formatted I/O
routines. However, you should not mix formatted I/O and non-formatted
I/O in the same session. See the following sections for descriptions and
code examples using formatted I/O and non-formatted I/O in VISA.
The VISA formatted I/O mechanism is similar to the C stdio
mechanism. The VISA formatted I/O functions are viPrintf, viQueryf,
and viScanf. Two non-buffered and non-formatted I/O functions,
viRead and viWrite, synchronously transfer data. Two additional
functions, viReadAsync and viWriteAsync were intended for
asynchronous data transfer but are imlemented synchronously in
Agilent VISA.
These are raw I/O functions and do not intermix with the formatted I/O
functions. See “Using Non-Formatted I/O” in this chapter for details.
Refer to the VISA Online Help for more information on how data is
converted under the control of the format string.