7-80 Chapter7
Programming Examples
Analyzer System Setup Examples
• The analyzer is released from remote control.
• The instrument state is changed by the operator.
• The learn string is sent back to the analyzer.
• The analyzer is released from remote control and the program ends.
Running the Program
Run the program. When the program stops, change the instrument state and press
on the controller. The analyzer will be returned to its original state by using the learn
string.
BASIC Program Listing
1 ! This program shows how to retrieve a learn string from the analyzer
2 ! into a string array. The state of the analyzer is then changed and the
3 ! learn string re-loaded to return the analyzer to the previous settings.
4 !
5 ! EXAMP5A
6 !
7 OPTION BASE 1
8 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
9 ASSIGN @Nwa_bin TO 716;FORMAT OFF
10 !
11 CLEAR SCREEN
12 ! Initialize the analyzer
13 ABORT 7 ! Generate an IFC (Interface Clear)
14 CLEAR @Nwa ! SDC (Selected Device Clear)
15 !
16 INTEGER Header,Length ! 2-byte header and length of string
17 !
18 OUTPUT @Nwa;”OUTPLEAS;” ! Output the learn string
19 ENTER @Nwa_bin;Header,Length ! Read header and length first
20 !
21 ALLOCATE INTEGER State(Length/2) ! Integer array to contain the string
22 !
23 ENTER @Nwa_bin;State(*) ! Read the string
24 LOCAL @Nwa ! Release HP-IB control
25 !
26 INPUT “Change state and press ENTER”,A$
27 !
28 OUTPUT @Nwa;”INPULEAS;” ! Send the learnstring to analyzer
29 OUTPUT @Nwa_bin;Header,Length,State(*)
30 DISP “Analyzer state has been restored!”
31 !
32 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analzyer to finish
33 ENTER @Nwa;Reply ! Read the 1 when complete
34 LOCAL @Nwa ! Release HP-IB control
35 END
Enter