Manual

GPIB Program Examples
WM-RCM-E Rev D ISSUED: February 2005
261
dev4: ibrd<CR>
enter byte count: 20<CR>
[2100] ( end cmpl )
count: 11
43 31 3A 43 50 4C 20 44 C 1 : C P L D
35 30 0A 5 0 z
dev4: q<CR> to quit the program.
SOURCE CODE EXAMPLE GPIB - 2
Use the GPIB Program for IBM PC (High-Level Function Calls)
The following BASICA program allows full interactive control of the oscilloscope using an IBM PC as GPIB
controller. As in Example 1, it is assumed that the controller is equipped with a National Instruments GPIB
interface card. All commands can be used following this example simply by entering the text string of the
command. For example, “C1:VDIV 50 MV” without the quotation marks. The program 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, a disk if the correct drive and file names are provided. The command
LC returns the oscilloscope to local mode. Responses sent back by the oscilloscope are interpreted as character
strings and are thus limited to a maximum of 255 characters.
INCLUDE – This line is symbolic of the National Instruments routines which
allow your language
to communicate with GPIB. Please see your NI manual for information.
CLS
PRINT "Control of the 9300 via GPIB and IBM PC" : PRINT
PRINT "Options : EX to exit LC local mode"
PRINT " ST store data RC recall data" : PRINT ""
LINE INPUT "GPIB-address of oscilloscope (1...16)? :",ADDR$
DEV$ = "DEV" + ADDR$ ‘ Construct DSO address.
CALL IBFIND (DEV$,SCOPE%)
IF SCOPE% < 0 THEN PRINT “IBFIND ERROR” : END ‘ Cannot find DSO.
TMO% = 10 ' Timeout = 300 msec (rather than default 10 sec)
CALL IBTMO(SCOPE%,TMO%)
LOOP% = 1
WHILE LOOP%
LINE INPUT "Enter command (EX --> Exit) : ",CMD$
Select Case CMD$
Case “ex”, “EX” : LOOP% = 0 : GOSUB LocalMode : END
Case "st", "ST" : GOSUB StoreData : GOTO LoopEnd
Case "rc", "RC" : GOSUB RecallData : GOTO LoopEnd
Case "lc", "LC" : GOSUB LocalMode : GOTO LoopEnd
Case "" : GOTO LoopEnd
End Select