526
S:\agilent\8920\8920b\PRGGUIDE\BOOK\CHAPTERS\callproc.fb
Chapter 8, Programming the Call Processing Subsystem
Example Programs
7200 IF Error_flag THEN
7210 RETURN 0
7220 ELSE
7230 RETURN 1
7240 END IF
7250 FNEND
7260 !
8000 Print_error: SUB Print_error
8010 OPTION BASE 1
8020 COM /Io_addresses/ INTEGER Inst_addr,Bus_addr
8030 COM /Prog_control/ INTEGER Oper_complete,Wait_time,Error_flag
8040 DIM Error_message$[255],Error$(5)[20]
8050 INTEGER Std_event,N
8060 Error$(2)="Query"
8070 Error$(3)="Device Dependent"
8080 Error$(4)="Execution"
8090 Error$(5)="Command"
8100 OUTPUT Inst_addr;"*ESR?"
8110 ENTER Inst_addr;Std_event
8120 FOR N=2 TO 5
8130 IF BIT(Std_event,N) THEN
8140 PRINT "A "&Error$(N)&" error has occurred."
8150 OUTPUT Inst_addr;"SYSTem:ERRor?"
8160 ENTER Inst_addr;Error_number,Error_message$
8170 PRINT Error_number,Error_message$
8180 END IF
8190 NEXT N
8200 IF BINAND(Std_event,195) THEN
8210 BEEP
8220 PRINT "Unrecognized condition. Standard Event register = ";Std_event
8230 END IF
8240 STOP
8250 SUBEND
8260 !
10000 Read_rcdd_data: SUB Read_rcdd_data(Fields$)
10010 OPTION BASE 1
10020 COM /Io_addresses/ INTEGER Inst_addr,Bus_addr
10030 DIM Rcdd$(6)[40]
10040 INTEGER N
10050 WAIT .1 !Allow time for RCDD data fields to be updated.
10060 FOR N=1 TO LEN(TRIM$(Fields$))
10070 OUTPUT Inst_addr;"CALLP:RCDD"&Fields$[N,N]&"?"
10080 ENTER Inst_addr;Rcdd$(N)
10090 PRINT "RCDD"&VAL$(N)&" = "&Rcdd$(N)
10100 NEXT N
10110 SUBEND
10120 !
11000 Meas_carrier: SUB Meas_carrier
11010 COM /Io_addresses/ INTEGER Inst_addr,Bus_addr
11015 ON TIMEOUT Bus_addr,5 RECOVER Timed_out