8-26 HP IBASIC Supplement
Interfacing with External Devices
Interfacing with an External Controller
The following program segment sends both numeric and string variable
queries and enters the resulting data:
10 ASSIGN @Prog TO 716
20 OUTPUT @Prog;”FORM ASCII,3”
30 OUTPUT @Prog;”PROG:NUMB? ’Test’”
40 ENTER @Prog;Testval
50 PRINT “The value of the variable Test=”;Testval
60 OUTPUT @Prog;”PROG:STR? ’A$’”
70 ENTER @Prog;STR$
80 PRINT “A$=”;Str$
90 End
Transferring Programs
Programs can be transferred between an external controller and
program memory using the GPIB download command
“PROGram[:SELected]:DEFine” and its upload query
“PROGram[:SELected]:DEFine?”. Programs that use these
mnemonics are run in the external controller.
Downloading
Program data transferred (downloaded) from the external controller to
the instrument is always transferred as an “arbitrary block.” The
arbitrary block may be a definite length or indefinite length block. The
indefinite length block is by far the easiest and is simply a block of data
that begins with the characters “#0” preceding the first line, and ends
with a line-feed character accompanied by an EOI signal on the GPIB
interface.
When using the mnemonic PROG:DEF to download program lines, the #0
must not be followed by a line-feed. Each program line must have a line
number at its beginning and a line-feed at its end. To end the arbitrary
block of program lines, a single line-feed must be output with the OUTPUT
END parameter, which sends the EOI (End or Identify) signal on the
GPIB control lines.
Refer to the Example Programs Guide for a listing of the example
program DOWNLOAD.