Remote Operation
Manual 20791, Rev. C, June 2001 3-3
Typical TBASIC Program for Swept Measurements
100 ! ***************************************************************
110 ! 8003 Swept Measurement Demonstration program
120 ! TBasic version
130 ! Copyright 2001, Giga-tronics Power Measurements Division
140 ! ***************************************************************
150 !
160 OPTION BASE 1! arrays start with index of 1
170 DIM Data array[512],Buffer$(5000)! allocate storage for swept data
180 !
190 POLL Status,Primary;4! Use serial poll to clear any existing srq s
200 WRITE GPIB CMD(Dcl)! Device Clear does a PRESET on the 8003
210 !
220 ! Set up Analyzer channel configuration first
230 !
240 PRINT @4:SWP 1,A;on;meas! channel 1 is in swept mode, sensor A,
250 ! and reads in absolute units
260 PRINT @4:SWP 2,B;on;meas! channel 2 is in swept mode, sensor B,
270 ! and reads in absolute units
280 PRINT @4:CHAN 3;off;CHAN 4;off! turn off channels 3 and 4
290 !
300 ! Now, set up the sweeper parameters
310 !
320 PRINT @4:SWPF;start 2000;stop 8000;level 10;swpt 500
330 ! Set start frequency 2GHz, stop frequency 8 GHz,
340 ! Output level +10 dBm, and sweep time 500 ms/sweep
350 PRINT @4:SWPF;level on! turn on RF output
360 SLEEP 8 ! put in appropriate wait time for sweeper to set up
370 !
380 ! These next lines set up display format but are not strictly
390 ! necessary for data collection over the bus
400 !
410 PRINT @4:GRAPH! graph display mode
420 PRINT @4:SWP 1;scale 1;ref pos 0;ref lev 10! scale channel 1
430 PRINT @4:SWP 2;scale 5;ref pos 0;ref lev 0! scale channel 2
440 !
450 ! Zero sensor A before taking a reading
460 !
470 ON SRQ GOTO Done zeroa! exit when zeroing done
480 PRINT @4:ZERO A;srq! Zero sensor A, pull srq when done
490 Loop1: GOTO Loop1! Wait until srq (or do other tasks)
500 Done zeroa: POLL Status,Primary;4! Clear srq with serial poll
560 OFF SRQ ! disable further srq s
570 !
580 ! Take a reading
590 !
600 SLEEP 4 ! put in time to make sure sweeper is settled
610 PRINT @4:OUTPUT 1;items 512! read 512 swept data points
620 INPUT @4 LINE Buffer$! Read data into string buffer
625 INPUT FROM Buffer$:Data array! convert to data array
630 PRINT Data array;
640 !
650 END