Chapter 7 7-63
Programming Examples
Measurement Data Transfer Examples
120 ABORT 7 ! Generate an IFC ( Interface Clear)
130 CLEAR @Nwa ! SDC (Selected Device Clear)
140 OUTPUT @Nwa;"OPC?;PRES;" ! Preset the analyzer and wait
150 ENTER @Nwa;Reply ! Read the 1 when completed
160 !
170 INTEGER Dheader,Dlength ! Integer variables for header info
180 Numpoints=11 ! Number of points in the trace
190 OUTPUT @Nwa;"POIN";Numpoints;";" ! Set number of points in trace
200 !
210 ! Set up data transfer
220 OUTPUT @Nwa;"OPC?;SING" ! Single sweep and wait
230 ENTER @Nwa;Reply ! Read the 1 when completed
240 !
250 OUTPUT @Nwa;"FORM3;" ! Select form 3 format
260 OUTPUT @Nwa;"OUTPFORM;" ! Send formatted output trace
270 !
280 ENTER @Nwadat;Dheader,Dlength ! Read headers from trace data
290 !
300 ALLOCATE Dat(1:Dlength/16,1:2) ! Use length to determine array size
310 ENTER @Nwadat;Dat(*) ! Read in trace data
320 !
330 PRINT "Size of array ";Dlength/16;" elements"
340 PRINT "Number of bytes ";Dlength
350 !
360 ! Print out the data array
370 PRINT "Element","Value 1"," Value 2"
380 IMAGE 3D,6X,3D.6D,6X,3D.6D
390 FOR I=1 TO Numpoints ! Loop through the data points
400 PRINT USING 380;I,Dat(I,1),Dat(I,2)
410 NEXT I
420 !
430 OUTPUT @Nwa;"MARKDISC;" ! Discrete marker mode
440 OUTPUT @Nwa;"MARK1 .3E+6;" ! Position marker at 30 KHz
450 !
460 OUTPUT @Nwa;"OPC?;WAIT;" ! Wait for the analyzer to finish
470 ENTER @Nwa;Reply ! Read the 1 when complete
480 LOCAL @Nwa ! Release HP-IB control
490 !
500 PRINT
510 PRINT "Position the marker with the knob and compare the values."
520 !
530 END