321
Chapter 5, Advanced Operations
Passing Control
The following IBASIC program would be loaded off the Memory Card and run in the Test Set:
10 COM /gpib_names/ INTEGER Internal_gpib,External_gpib
20 COM /Cntrl_names/ Ext_cntrl_addrs,Int_cntrl_addrs
30 COM /Io_names/ INTEGER Printer_addrs,Pwr_suply_addrs
40 COM /Io_values/ REAL Meas_power
50 !
60 Internal_gpib=800
70 External_gpib=700
80 Ext_cntrl_addrs=21
90 Int_cntrl_addrs=14
100 Printer_addrs=1
110 Pwr_suply_addrs=26
120 !
130 OUTPUT Internal_gpib;"*RST"
140 CLEAR SCREEN
150 PRINTER IS CRT
160 !
170 EXECUTE ("REQUEST_CONTROL")
180 !
190 Try_again: !
200 ON ERROR GOTO Not_actve_cntrl
210 DISP "WAITING TO GET CONTROL"
220 OUTPUT External_gpib;"" !If OUTPUT successful then Active Controller
230 !If OUTPUT not successful then not Active Controller
240 DISP "TEST SET NOW ACTIVE CONTROLLER."
250 CALL Start_program
260 !
270 Pass_back: !
280 DISP "PASSING CONTROL BACK"
290 !Control is passed back automatically when the program stops
300 !Control is passed back to address specified by *PCB command
310 DISP "PROGRAM FINISHED"
320 STOP
330 !
340 Not_actve_cntrl: !
350 OFF ERROR
360 DISP "CHECKING FOR ERROR"
370 IF ERRN=173 THEN
380 GOTO Try_again
390 ELSE
400 PRINT "ERROR =";ERRN
410 STOP
420 END IF
430 !
440 END
450 !
460 SUB Start_program
470 !
480 COM /Gpib_names/ INTEGER Internal_gpib,External_gpib
490 COM /Cntrl_names/ Ext_cntrl_addrs,Int_cntrl_addrs
500 COM /Io_names/ INTEGER Printer_addrs,Pwr_suply_addrs
510 COM /Io_values/ REAL Meas_power
520 !
530 PRINT "SETTING POWER SUPPLY"
540 OUTPUT External_gpib+Pwr_suply_addrs;"IMAX 8;ISET 5"
550 OUTPUT External_gpib+Pwr_suply_addrs;"VMAX 15;VSET 13.2"
560 !
570 PRINT "SETTING UP INTERNAL INSTRUMENTS"
580 OUTPUT Internal_gpib;"RFG:FREQ 850.030 MHz;AMPL -40 dBm"
590 OUTPUT Internal_gpib;"AFG1:FREQ 3 KHZ;DEST ’FM’;FM 3 KHZ"