Chapter 7 7-65
Programming Examples
Measurement Data Transfer Examples
BASIC Program Listing
10 ! This program shows how to read in a trace and create the frequency
20 ! value associated with the trace data value. EXAMP3C is used to
30 ! read in the data from the analyzer. The start and stop
40 ! frequencies are set to provide two decades of log range. Log sweep
50 ! is set and the frequency data points are read from the limit test
60 ! array and displayed with the data points.
70 !
80 ! EXAMP3D
90 !
100 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
110 ASSIGN @Nwadat TO 716;FORMAT OFF ! Binary path for data transfer
120 !
130 CLEAR SCREEN
140 ! Initialize the analyzer
150 ABORT 7 ! Generate an IFC ( Interface Clear)
160 CLEAR @Nwa ! SDC (Selective Device Clear)
170 OUTPUT @Nwa;"OPC?;PRES;" ! Preset the analyzer and wait
180 ENTER @Nwa;Reply ! Read the 1 when completed
190 !
200 INTEGER Dheader,Dlength ! Integer variables for header info
210 !
220 OUTPUT @Nwa;"POIN 11;" ! Set trace length to 11 points
230 OUTPUT @Nwa;"STAR 50.E+6;" ! Start frequency 50 MHz
240 OUTPUT @Nwa;"STOP 200.E+6;" ! Stop frequency 200 MHz
250 OUTPUT @Nwa;"LOGFREQ;" ! Set log frequency sweep
260 !
270 ! Set up data transfer
280 OUTPUT @Nwa;"OPC?;SING" ! Single sweep and wait
290 ENTER @Nwa;Reply ! Read the 1 when completed
300 !
310 OUTPUT @Nwa;"FORM3;" ! Select form 3 trace format
320 OUTPUT @Nwa;"OUTPFORM;" ! Output formatted trace
330 !
340 ENTER @Nwadat;Dheader,Dlength ! Read headers from trace data
350 !
360 ALLOCATE Dat(1:Dlength/16,1:2) ! Use length to determine array size
370 ENTER @Nwadat;Dat(*) ! Read in trace data
380 !
390 ! Create the corresponding frequency values for the array
400 !
410 ! Read the frequency values using the limit test array
420 ALLOCATE Freq(1:Dlength/16,1:4) ! Limit line results array
430 ! Limit line values are frequency, test results, upper and lower limits
440 !
450 OUTPUT @Nwa;"OUTPLIML;" ! Request limit line test results
460 ENTER @Nwa;Freq(*) ! Read 4 values per point
470 !
480 ! Display table of freq and data
490 !
500 PRINT " Freq (MHz)","Mag (dB)" ! Print table header
510 FOR I=1 TO 11 ! Cycle through the trace values
520 Freqm=Freq(I,1)/1.E+6 ! Convert frequency to MHz
530 PRINT USING "4D.6D,9X,3D.3D";Freqm,Dat(I,1) ! Print trace data
540 NEXT I
550 !
560 ! Set up marker to examine frequency values