Chapter 7 7-83
Programming Examples
Analyzer System Setup Examples
240 !
250 READ Calt$,Numb ! Read CAL type from data statement
260 IF Numb=0 THEN GOTO 690 ! If no CAL type is present Exit
270 OUTPUT @Nwa;Calt$;"?;" ! Query if CAL type is active
280 ENTER @Nwa;Active ! Read 1 if active
290 IF NOT Active THEN GOTO 250 ! Load another CAL type and re-try
300 !
310 PRINT Calt$,Numb ! Active CAL and number of arrays
320 !
330 OUTPUT @Nwa;"FORM3;" ! Form 3 IEEE 64 bit floating point
340 OUTPUT @Nwa;"POIN?;" ! Request trace length
350 ENTER @Nwa;Poin ! Read number of points
360 ALLOCATE Cal(1:Numb,1:Poin,1:2) ! Arrays for CAL arrays
370 ! Number of arrays, number of points real and imag value per point
380 !
390 FOR I=1 TO Numb ! Read arrays
400 OUTPUT @Nwa USING "K,ZZ";"OUTPCALC",I ! Format I to add 0 in command
410 ENTER @Nwa_bin;Hdr,Lgth ! Read header & length from array
420 FOR J=1 TO Poin ! Read elements for CAL array
430 ENTER @Nwa_bin;Cal(I,J,1),Cal(I,J,2) ! Read real & imag pair elements
440 NEXT J ! Next location in array
450 NEXT I ! Next CAL array
460 !
470 ! All CAL arrays have been read
480 !
490 INPUT "PRESS RETURN TO RE-TRANSMIT CALIBRATION",Dum$
500 !
510 OUTPUT @Nwa;"FORM3;" ! Use same format as read
520 OUTPUT @Nwa;Calt$;";" ! Send CAL type to analyzer
530 !
540 FOR I=1 TO Numb ! Send each array in CAL
550 DISP "TRANSMITTING ARRAY: ",I ! Show array number
560 OUTPUT @Nwa USING "K,ZZ";"INPUCALC",I ! Send array number 0 format
570 OUTPUT @Nwa_bin;Hdr,Lgth ! Send header & array length
580 FOR J=1 TO Poin ! Send each array element
590 OUTPUT @Nwa_bin;Cal(I,J,1),Cal(I,J,2) ! Real and Imag pair
600 NEXT J ! Next element in array
610 NEXT I ! Next array
620 !
630 OUTPUT @Nwa;"SAVC;" ! Activate CAL
640 !
650 OUTPUT @Nwa;"CONT;" ! Restore continuous sweep
660 OUTPUT @Nwa;"OPC?;WAIT;" ! Wait for analyzer to finish
670 ENTER @Nwa;Reply ! Read the 1 when complete
680 !
690 DISP "Finished with CAL transfer"
700 LOCAL @Nwa ! Release HP-IB control
710 END