Section Four A
BASICA/QuickBASIC GPIB-PC Function Calls
©National Instruments Corp.
4A-101
GPIB-PC User Manual
BASICA/QuickBASIC GPIB Programming
Examples
This section illustrates the programming steps that could be used to
program a representative IEEE-488 instrument from your personal
computer using the GPIB-PC handler functions. The applications are
written in BASICA and QuickBASIC. The target instrument is a digital
voltmeter (DVM). This instrument is otherwise unspecified (that is, it is
not a DVM manufactured by any particular manufacturer). The purpose
here is to explain how to use the handler to execute certain
programming and control sequences and not how to determine those
sequences.
Because the instructions that are sent to program a device as well as the
data that might be returned from the device are called device
dependent messages, the format and syntax of the messages used in
this example are unique to this device. Furthermore, the interface
messages or bus commands that must be sent to devices will also vary,
but to a lesser degree. The exact sequence of messages to program and
to control a particular device are contained in its documentation.
For example, the following sequence of actions is assumed to be
necessary to program this DVM to make and return measurements of a
high frequency AC voltage signal in the autoranging mode:
1.
Initialize the GPIB interface circuits of the DVM so that it can
respond to messages.
2.
Place the DVM in remote programming mode and turn off front
panel control.
3.
Initialize the internal measurement circuits.
4.
Program the DVM to the proper function (F3 for high frequency
AC volts), range (R7 for autoranging), and trigger source (T3
for external or remote).
5.
For each measurement:
a.
Send the GET (Group Execute Trigger) command to trigger
the DVM.
b.
Wait until the DVM asserts Service Request (SRQ) to
indicate that the measurement is ready to be read.