Chapter 7 7-61
Programming Examples
Measurement Data Transfer Examples
170 ! Trace values are two elements per point, display format dependent
180 DIM Dat(1:11,1:2) ! Trace data array
190 !
200 OUTPUT @Nwa;"POIN 11;" ! Set trace length to 11 points
210 OUTPUT @Nwa;"OPC?;SING;" ! Single sweep mode and wait
220 ENTER @Nwa;Reply ! Read reply
230 !
240 OUTPUT @Nwa;"FORM4;" ! Set form 4 ASCII format
250 OUTPUT @Nwa;"OUTPFORM;" ! Send formatted trace to controller
260 ENTER @Nwa;Dat(*) ! Read in data array from analyzer
270 !
280 ! Now to calculate the frequency increments between points
290 OUTPUT @Nwa;"POIN?;" ! Read number of points in the trace
300 ENTER @Nwa;Num_points
310 OUTPUT @Nwa;"STAR?;" ! Read the start frequency
320 ENTER @Nwa;Startf
330 OUTPUT @Nwa;"SPAN?;" ! Read the span
340 ENTER @Nwa;Span
350 !
360 F_inc=Span/(Num_points-1) ! Calculate fixed frequency increment
370 !
380 PRINT "Point","Freq (MHz)"," Value 1"," Value 2"
390 IMAGE 3D,7X,5D.3D,3X,3D.4D,3X,3D.4D ! Formatting for controller display
400 !
410 FOR I=1 TO Num_points ! Loop through data points
420 Freq=Startf+(I-1)*F_inc ! Calculate frequency of data point
430 PRINT USING 390;I,Freq/1.E+6,Dat(I,1),Dat(I,2)! Print analyzer data
440 NEXT I
450 !
460 OUTPUT @Nwa;"MARKDISC;" ! Discrete marker mode
470 OUTPUT @Nwa;"MARK1 3E+4;" ! Position marker at 30 KHz
480 !
490 OUTPUT @Nwa;"OPC?;WAIT;" ! Wait for the analyzer to finish
500 ENTER @Nwa;Reply ! Read the 1 when complete
510 LOCAL 7 ! Release HP-IB control
520 !
530 PRINT
540 PRINT "Position the marker with the knob and compare the values"
550 !
560 END