|
Appendix A
|
EXAMPLE 2:
GPIB PROGRAM FOR
IBM PC (HIGH-LEVEL
FUNCTION CALLS)
200
The following BASICA program allows full interactive control of
the 9420/24/50 using an IBM PC as GPIB controller. It is again
assumed that the controller is equipped with a National Instru-
ments GPIB interface card. All the remote control commands
listed in Section 5 can be used by simply entering the text string of
the command, i.e. "c 1 :vdiv 50 mv" (without the quotes). The pro-
gram automatically displays the information sent back by the
oscilloscope in response to queries.
In addition, a few utilities have been provided for convenience.
The commands ST and RC enable waveform data to be stored on
or retrieved from disk if proper drive and file names are provided.
The command LC returns the oscilloscope to local mode. Re-
sponses sent back by the oscilloscope are interpreted as character
strings and are thus limited to a maximum of 255 characters.
Note 1: It is assumed that the National Instruments GPIB driver
GPIB. COM is in its default state. This means that the interface
board can be referred to by its symbolic name ’GPIBO’ and that
devices on the GPIB with addresses 1 to 16 can be called by the
symbolic name ’DEVI ’ to ’DEV16’.
Note 2: Lines 1 - 99 are a copy of the file DECL.BAS supplied by
National Instruments. The first 6 lines are required for the initial-
ization of the GPIB handler. DECL.BAS requires access to the file
BIB.M during the GPIB initialization. BIB.M is one of the files
supplied by National Instruments, and must exist in the directory
currently in use.
Note 3: The first 2 lines of DECL.BAS each contain a string
"XXXXX" which must be replaced by the number of bytes which
determine the maximum workspace for BASICA (computed by
subtracting the size of BIB.M from the currently available space in
BASICA). For example, if the size of BIB.M is 1200 bytes and
when BASICA is loaded it reports "60200 bytes free ", you would
replace "XXXXX" by the value 59000 or less.
Note 4: The default timeout of lO seconds is modified to 300 msec
during the execution of this program. However, the default value
of the GPIB handler is not changed. Whenever a remote command
is entered by the user, the program sends it to the instrument with
the function call IBWRT. Afterwards, it always executes an IBRD
call, independently of whether or not a response is expected. If a
response is received it is immediately displayed. If there is no re-
sponse, the program waits until time-out and then asks for the
next command.