GPIB Operation 3
Explanation
Lines 1 - 99 are a copy of the file DECL.BAS supplied by National
Instruments. The first 6 lines are required for the initialization of
the GPIB handler. The other lines are declarations which may be
useful for larger programs, but are not really required code. The
sample program above only uses the strings CMD$ and RD$ which
are declared in DECL.BAS as arrays of 255 characters.
Note: 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 it must exist in the directory currently in use.
Note: 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 space currently available in
BASICA). For example, if the size of BIB.M is 1200 bytes and
when BASICA is loaded it reports "60200 bytes free ", you should
replace "XXXXX" by the value 59000 or less.
Lines 100 and 110 open the device "DEV4" and associate with it
the descriptor "SCOPE%". All I/O calls from now on will refer to
"SCOPE%". The default configuration of the GPIB handler recog-
nizes
"DEV4"
and associates with it a device with GPIB address 4.
If you want to use another GPIB address between 1 and 16, use
the string "DEVx" with x = 1...16. If you want to use another
name, run IBCONF.EXE to declare this name to the handler.
Lines 120 and 130 prepare the command string TDIV? and trans-
fer it to the instrument. The command instructs it to respond with
the current setting of the time base.
Line 140 reads the response of the instrument and places it into
the character string RD$.
Line 150 displays the response on the terminal.
When running this sample program, the oscilloscope will automati-
cally be set to the remote state when IBWRT is executed, and will
remain in that state. Pressing the LOCAL button on the front pan-
el will return the oscilloscope to local mode if the GPIB handler
was modified to inhibit Local LOckout (LLO).
Here is a slightly modified version of the sample program which
checks if any error occurred during GPIB operation:
17