User`s manual

Using the Relay Matrix Switches 35Chapter 2
Example: Saving and
Recalling States
This examples closes channels on the module and saves the state as
number 5. When the saved state is recalled, only the channels that were
closed in the stored state are closed. All other channels in the switchbox
are opened.
10 OUTPUT 70914;"CLOS (@10000:10015)"
!Close ch 00 through 15
20 OUTPUT 70914; "*SAV 5"
!Save as state 5
30 OUTPUT 70914; "*RST; *CLS"
!Reset and clear status reg
40 OUTPUT 70914; "CLOS (@10113,10112,10200)"
!Close ch 13, 12, 00
50 OUTPUT 70914; "*RCL 5"
!Recall the stored state.
60 END
Detecting Error
Conditions
You can use the SYST:ERR? command to poll the switchbox for errors.
You can also use interrupts to signal the controller when an error occurs.
Example: Illegal Channel
Closure Error
This program attempts an illegal channel closure and polls for the error
message:
10 DIM Err_num$[256]
20 OUTPUT 70914; "CLOS (@10500)"
30 OUTPUT 70914; "SYST:ERR?"
40 ENTER 70914; Err_num$
50 PRINT Err_num$
Example: Using
Interrupts to Signal
Errors
This program uses an interrupt to signal the controller when an error occurs.
The SYST:ERR? command returns the error message.
10 ON INTR 7 CALL Errmsg
!Call subprogram Errmsg if a module
!programming error occurs
20 ENABLE INTR 7:2
!Enable the computer to respond to the
interrupt from the module
30 OUTPUT 70914; "*SRE 32; *ESE 64"
!Unmask the Event Status bit in the module’s
!Status Register (*SRE 32). Unmask the
!module error conditions in its Standard Event
Status Register (*ESE 64).
40 OUTPUT 70914 ". . . .
!Continue program execution
.
.
100 END
110 SUB Errmsg
120 DIM Message$[256]
130 CLEAR 709
!When an error occurs, clear the module to
!regain control.
140 B = SPOLL (70914)
!Execute a Serial Poll to clear the Service
!Request bit in the Status Register.
150 REPEAT