User`s guide
4-32
Programming
Programming Examples
Example 1: Switch position using the *WAI command
This program prompts the operator for the desired switch position and then
moves the switch to this position. The switch error queue is then read and
printed. The program shows how to use the *WAI command to ensure that the
switch has settled to its new position.
Listing 10 INTEGER Switch_addr,A_position,B_position
20 DIM Command$[80],Channel$[80],Error_return$[80],
Dummy$[80]
30 Switch_addr=711
40 CLEAR SCREEN
50 INPUT "Enter A-port position : ",A_position
60 INPUT "Enter B-port position : ",B_position
70 Channel$="A"&TRIM$(VAL$(A_position))&",B"&TRIM$
(VAL$(B_position))
80 Command$="ROUTE:LAYER1:CHANNEL "&Channel$
90 OUTPUT Switch_addr;Command$
100 GOSUB Wait_to_settle
110 REPEAT
120 OUTPUT Switch_addr;"SYSTEM:ERROR?"
130 ENTER Switch_addr;Error_return$
140 PRINT Error_return$
150 UNTIL (VAL(Error_return$)=0)
170 GOTO Exit_prog
180 !
190 Wait_to_settle: ! wait for switch to settle
200 OUTPUT Switch_addr;"*WAI"
210 OUTPUT Switch_addr;"SYSTEM CONFIG?"
220 ENTER Switch_addr;Dummy$
230 RETURN
240 !
250 Exit_prog:!
260 END
Description
Line No.
1
10 to 20 Declare some variables for use in the program.
30 Set the Agilent 8606X Optical Switch address variable,
Switch_addr
, to 711 (factory default).
40 to 60 Clear the screen and prompt the operator for the desired
switch position. Store the positions in variables
A_position and B_position
.
70 Set
Channel$
to represent the switch channel positions in