Agilent Technologies A.18.00 Weather Radio User Manual


 
61
Chapter 2, Methods For Reading Measurement Results
HP
®
BASIC ‘ON TIMEOUT’ Example Program
10 COM /Io_names/ INTEGER Inst_addr,Bus_addr
20 CLEAR SCREEN
30 Inst_addr=714
40 Bus_addr=7
50 CLEAR Inst_addr
60 OUTPUT Inst_addr;"TRIG:ABORT"
70 OUTPUT Inst_addr;"*RST"
80 OUTPUT Inst_addr;"DISP RFAN"
90 !
100 ! Execute a call to the Measure function with a request to measure RF
110 ! power. The time out value is specified as 10 seconds. The value
120 ! returned by the function is assigned to the variable Measure_result.
130 !
140 Measure_result=FNMeasure("MEAS:RFR:POW?",10)
150 !
160 ! Check the result of the function call.
170 !
180 IF Measure_result=9.E+99 THEN
190 PRINT "Measurement failed."
200 ELSE
210 PRINT "Power = ";Measure_result
220 END IF
230 END
240 !***********************************************************
250 ! Recommended Technique:
260 !***********************************************************
270 DEF FNMeasure(Query_command$,Time_out_value)
280 COM /Io_names/ INTEGER Inst_addr,Bus_addr
290 DISABLE
300 ON TIMEOUT Bus_addr,Time_out_value RECOVER Timed_out
310 OUTPUT Inst_addr;"TRIG:MODE:RETR SING;:TRIG:IMM"
320 OUTPUT Inst_addr;Query_command$
330 ENTER Inst_addr;Result
340 OUTPUT Inst_addr;"TRIG:MODE:RETR REP"
350 ENABLE
360 RETURN Result
370 Timed_out:!
380 ON TIMEOUT Bus_addr,Time_out_value GOTO Cannot_recover
390 CLEAR Inst_addr
400 OUTPUT Inst_addr;"TRIG:ABORT;MODE:RETR REP"
410 ENABLE
420 RETURN 9.E+99
430 Cannot_recover:!
440 DISP "Cannot regain control of Test Set."
450 STOP
460 FNEND