User`s guide

2-42
GPIB Tutorial and Examples
Program 3
1100 Message$(9)=” Seconds.”
1110 Message$(10)=”Time for phone to camp and answer page: “
1120 Message$(11)=”Time for testing : “
1130 Message$(12)=”Time for call clear down : “
1140 !
1150 Emptyst$=”@”
1160 Empty=-999
1170 Nullst$(1,1)=Emptyst$
1180 Null(1,1)=Empty
1190 !
1200 !==========================================================================
1210 !
1220 !ERROR AND TIMEOUT HANDLING
1230 !
1240 Busport=INT(Uut/100) !Get the GPIB port code from Uut
address
1250 CLEAR Busport !Clear bus from any aborted previous
commands
1260 Timeinit$=”yes” !Set a flag so timeout code is not
executed first pass
1270 ON TIMEOUT Busport,Timeouttime GOTO Timeflag !Establish goto flag
for GPIB timeouts
1280 Timeflag:IF Timeinit$<>”yes” THEN !After a timeout, execution comes
here
1290 OFF TIMEOUT Busport
1300 CLEAR Busport !Clear any half done commands
1310 OUTPUT Uut;”TRIG:AST ‘disarm’” !Dissarm the DSP trigger
1320 CALL Sub_syserror(Uut,Error$(*),Errcount) !Gather any error message from the
Agilent 8922M/S
1330 PRINT “Measurement Timed Out. Ending Test”
1340 IF Errcount=0 THEN
1350 Errcount=1
1360 Error$(1)=”No errors recorded”
1370 END IF
1380 FOR X=1 TO Errcount !Print error messages
1390 PRINT Error$(X)
1400 NEXT X
1410 STOP !Execution stops here after critical
errors
1420 ELSE
1430 Timeinit$=”no” !Reset flag so next time, it must
be a real timeout
1440 END IF
1450 Errcount=0
1460 CALL Sub_syserror(Uut,Error$(*),Errcount) !Clear any old errors from
Agilent 8922M/S before the
1470 Errcount=0 !test begins
1480 !
1490 !===========================================================================
1500 !
1510 !PRESET THE Agilent 8922M/S AND SET IT TO THE CORRECT COMPATIBILITY MODE (exe-
cuted once only)
1520 !
1530 !
1540 OUTPUT Uut;”*RST” !Preset the Agilent 8922M/S
1550 OUTPUT Uut;”CONF:COMP?” !Check compatability mode and set
to F or H
1560 ENTER Uut;Product$
1570 IF Product$<>”””8922S””” AND Product$<>”””8922M””” THEN
1580 IF Product$=”””8922E””” THEN OUTPUT Uut;”CONF:COMP ‘8922S’”
1590 IF Product$=”””8922G””” THEN OUTPUT Uut;”CONF:COMP ‘8922M’”
1600 OUTPUT Uut;”*RST” !A preset is needed after compat-
ability change
1610 END IF
1620 CALL Sub_syserror(Uut,Error$(*),Errcount) !Check for any errors logged by
Agilent 8922M/S
1630 !