630
Chapter 8, Programming The Call Processing Subsystem
Example Programs
7020 COM /Prog_control/ INTEGER
Oper_complete,Wait_time,Error_flag
7030 Oper_complete=0 !Initialize to zero at start of any order to
mobile
7040 Error_flag=0 !Initialize to zero at start of any order to
mobile
7050 SELECT Order$
7060 CASE "Power"
7070 OUTPUT Inst_addr;"STAT:CALLP:PTR 32"
7080 OUTPUT Inst_addr;"CALLP:ORD ’CHNG PL "&VAL$(Parm)&"’"
7090 CASE "Mainten"
7100 BEEP
7110 OUTPUT Inst_addr;"STAT:CALLP:PTR 16;:CALLP:ORD ’MAINTEN’"
7120 CASE "Alert"
7130 BEEP
7140 OUTPUT Inst_addr;"STAT:CALLP:PTR 32;:CALLP:ORD ’ALERT’"
7150 END SELECT
7160 LOOP
7170 WAIT Wait_time
7180 EXIT IF Oper_complete OR Error_flag
7190 END LOOP
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