310 Chapter5
Programming
Data Transfer to Computer
Example 6 shows how to transfer data in B-format from the spectrum
analyzer to a computer.
EXAMPLE 6
10 INTEGER Tra_binary(1:601)
20 ASSIGN @Sa_bin TO 718;FORMAT OFF
30 OUTPUT 718;"IP;CF 300MHZ;SP 20MHZ;SNGLS;TS;"
40 CALL Get_settings(Fa,Fb,Rl,Rb,Vb,St,Lg,Aunits$)
50 OUTPUT 718;"TDF B;TRA?"
60 ENTER @Sa_bin;Tra_binary(*)
70 END
Line 10 dimensions the array Tra_binary to 601 elements. Here the
INTEGER statement dimensions each array element as two bytes
(remember, each data point transferred in B-format is sent as two 8-bit
bytes).
Line 20 assigns the spectrum analyzer address to "@Sa_bin". Format is
set to off because the trace data is transferred in the format of two 8-bit
bytes and this format is also the internal format of the computer.
Line 40 enters the instrument state conditions.
Line 50 selects B-format, then queries the spectrum analyzer for trace
A data.
Line 60 enters the data into the array Tra_binary.
To convert a trace-data point from binary to a real, logarithmic number
(for example, dBm), use the equation below:
where:
x = binary data in an array element
RL = reference level in dBm, dBmV, or dBµV
Log Scale = the log scale in units of dB per division selected on
the spectrum analyzer.
n = real, log data
n RL 10 divisions Log Scale Log Scale
x
600 10 divisions⁄
------------------------------------------
×+×–=
RL= Log Scale
x
600 10 divisions⁄
------------------------------------------ 10 divisions–
×+