Chapter 7 7-77
Programming Examples
Measurement Process Synchronization Examples
BASIC Program Listing
10 ! This routine does a power meter cal using pass control.
20 ! A measurement cycle takes place on each point of the trace. The
30 ! point is measured by the power meter and the measured value read
40 ! into the analyzer. The command TAKCS; arms this measurement mode.
50 ! The number of measurements is determined by the number of points in
60 ! the trace, the number of readings per point and an extra measurement
70 ! cycle to release the powr meter.
80 ! Control is passed to the analyzer, the point is measured and
90 ! the data is transferred to the analyzer. Control is passed back to
100 ! the controller and the cycle begins again. Serial poll is used to
110 ! read the status byte of the analyzer and test the logic.
120 ! The HP-IB interface status register is monitored to determine when
130 ! control is returned to the interface from the analyzer.
140 !
150 ! EXAMP4C
160 !
170 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
180 !
190 CLEAR SCREEN
200 ! Initialize the analyzer
210 ABORT 7 ! Generate an IFC (Interface Clear)
220 CLEAR @Nwa ! SDC (Selective Device Clear)
230 OUTPUT @Nwa;"OPC?;PRES;" ! Preset the analyzer and wait
240 ENTER @Nwa;Reply ! Read the 1 when complete
250 !
260 INTEGER Stat
270 !
280 ! Set up the analyzer parameters
290 Numpoints=11 ! Number of points in the trace
300 Numreads=2 ! Number of readings per point
310 Startf=1.00E+8 ! Start frequency
320 Stopf=5.0E+8 ! Stop frequency
330 !
340 OUTPUT @Nwa;"POIN";Numpoints;";" ! Set trace length to numpoints
350 OUTPUT @Nwa;"NUMR";Numreads;";" ! Set number of readings per point
360 OUTPUT @Nwa;"STAR";Startf ! Set start frequency
370 OUTPUT @Nwa;"STOP";Stopf ! Set stop frequency
380 OUTPUT @Nwa;"MEASR;" ! Measure the reference channel
390 !
400 ALLOCATE Pmcal(1:Numpoints) ! Create power meter cal array
410 !
420 ! Store the original trace for comparison
430 OUTPUT @Nwa;"DATI;"
440 OUTPUT @Nwa;"DISPDATM;"
450 OUTPUT @Nwa;"AUTO;"
460 !
470 ! Select the power meter being used for cal
480 ! OUTPUT @Nwa;"POWM ON;" ! Select 436A power meter
490 OUTPUT @Nwa;"POWMOFF;DEBUON;" ! Select 437B/438A power meter
500 !
510 ! Set analyzer HP-IB, status regs to interrupt on pass control
520 OUTPUT @Nwa;"CLES;" ! Clear status registers
530 OUTPUT @Nwa;"ESE2;" ! Enable request control summary bit
540 OUTPUT @Nwa;"SRE32;" ! SRQ on events status register
550 !
560 PRINT "Beginning Power Meter CAL"