Program Example for the RS-232 Interface
10 'File
=
232PROG6
20 OPEN
"COMl:9600,N,8,1"
AS
#l
30 'create a
401-point
trace array
40 DIM
TRCA(401)
50 PRINT
#l,"IP;"
60 'set output format of spectrum analyzer for real numbers
70 PRINT
#l,"TDF
P;"
80 'set spectrum analyzer parameters
90 PRINT
#l
"SNGLS."
100 PRINT
#;,"CF
3;OMZ;"
110 PRINT
tl,"SP
200MZ;"
120 PRINT #1
"TS."
130 PRINT
#l:"MKPK;"
140 'move peak to center of spectrum analyzer screen
150 PRINT #1
"MKCF."
160 PRINT
#l:"TS;"'
170 'ask spectrum analyzer for trace data
180 PRINT #1
"TRA'."
190 'input the
t&e
data to the BASIC program
200
FOR
I=1
TO 401
210 INPUT
#l,TRCA(I)
'data input in
dBm
220
NEXT I
230 'create file to store trace on disk
240 OPEN
"TRACEA"
FOR OUTPUT AS
#2
250 'print the trace data to the disk
260
FOR
I=1
TO 401
270 PRINT
#2,TRCA(I)
280
NEXT I
290 'put spectrum analyzer into continuous-sweep mode
300 PRINT
tl
"CONTS."
,
,
310 END
Using the OPEN command, we create an empty file on the disk for storing the trace and assign
an input and an output path to the file
TRACEA.
Then we send the trace data to the file. (See
lines 260 through 280.)
Lines 20 through 220 of
232PROG6
are identical to the previous program,
232PROG5.
Programming Topics 3-5