Program Example for the RS-232 Interface
10 'File
=
232PROG5
20 OPEN
"COMl:9600,N,8,1"
AS
#l
30 'create a
401-point
trace array
40 DIM
TRCA(401)
50 PRINT #1
"IP."
60 'set
outiut
iormat
of spectrum analyzer for real numbers
70 PRINT
#l,"TDF
P;"
80 ‘set spectrum analyzer parameters
90 PRINT
#l,"SNGLS;"
100 PRINT
#l,"CF
300MZ;"
110 PRINT
#l,"SP
200MZ;”
120 PRINT
#l,"TS;"
130 PRINT
tl
"MKPK."
140 'move
peik
to
lenter
of spectrum
analyzer screen
150 PRINT
#l
"MKCF."
3
,
160 PRINT #1
"TS."
170 'ask
spe&r&
analyzer for trace data
180 PRINT
#l,"TRA?;"
190 'retrieve trace data from spectrum analyzer
200
FOR
I=1
TO 401
210 INPUT
#l,TRCA(I)
220
NEXT I
230 'set continuous-sweep mode
240 PRINT
#l,"CONTS;"
250
END
Trace data can be read with the computer by making three changes to the program created
in Chapter 2. First, we modify the program to create a 401-point trace array, called TRCA
in which trace data will be stored (line 40). Second, the program uses the TRA command to
request trace A data (line 180). (The MKA and MKF commands in the original program have
been deleted.) Third, we will have the spectrum analyzer send the trace A data into the TRCA
variable (line 210).
Programming Topics 3-3