Chapter 7 7-95
Programming Examples
List-Frequency and Limit-Test Table Examples
BASIC Program Listing
10 ! This program shows how to select a single segment from a list
20 ! frequency sweep and activate it as the sweep. The list frequency
30 ! table is read from the analyzer and displayed on the computer
40 ! screen. The operator is prompted to select a segment and the
50 ! program then activates it. All the segments are activated upon
60 ! completion.
70 !
80 ! EXAMP6C
90 !
100 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
110 !
120 CLEAR SCREEN
130 ! Initialize the analyzer
140 ABORT 7 ! Generate an IFC (Interface Clear)
150 CLEAR @Nwa ! SDC (Selected Device Clear)
160 !
170 ! Print header for table of existing segments
180 PRINT USING “10A,15A,15A,20A”;”SEGMENT”,”START(MHZ)”,”STOP(MHZ)”,”NUMBER OF
POINTS”
190 OUTPUT @Nwa;”EDITLIST;” ! Edit list frequency segment
200 OUTPUT @Nwa;”SEDI30;” ! Set largest segment number
210 OUTPUT @Nwa;”SEDI?;” ! Request number of highest segment
220 ENTER @Nwa;Numsegs ! Read number of actual segments
230 !
240 ! Setup table and read segments from analyzer
250 ALLOCATE Table(1:Numsegs,1:3) ! Allocate table of segments
260 FOR I=1 TO Numsegs ! Cycle through segments
270 GOSUB Readlist ! Read in segment definitions
280 NEXT I ! Next segment
290 !
300 ! Loop and read segment to be activated
310 LOOP ! Request operator to enter segment
320 INPUT “SELECT SEGMENT NUMBER: (0 TO EXIT)”,Segment
330 EXIT IF Segment=0 ! Exit point
340 OUTPUT @Nwa;”EDITDONE;”;”SSEG”;Segment;”;” ! Set active segment to sweep
350 END LOOP ! End activation loop
360 !
370 OUTPUT @Nwa;”ASEG;” ! Set all segment sweep
380 DISP “PROGRAM ENDED”
390 !
400 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for analyzer to finish
410 ENTER @Nwa;Reply ! Read the 1 when complete
420 LOCAL @Nwa ! Release HP-IB control
430 STOP ! End of main program
440 !
450 ! ************************** Subroutines *******************************
460 !
470 Readlist: ! Read segment list from analyzer
480 OUTPUT @Nwa;”EDITLIST;” ! Edit segment list
490 OUTPUT @Nwa;”SEDI”,I,”;” ! Select segment to edit
500 OUTPUT @Nwa;”STAR;” ! Send start freq to display value
510 OUTPUT @Nwa;”OUTPACTI;” ! Output active function value
520 ENTER @Nwa;Table(I,1) ! Read start frequency
530 OUTPUT @Nwa;”STOP;” ! Send stop freq to display value
540 OUTPUT @Nwa;”OUTPACTI;” ! Output active function value
550 ENTER @Nwa;Table(I,2) ! Read stop frequency