Reading and Writing Files R&S FSL
1300.2519.12 7.24 E-11
CALL InstrWrite(analyzer,"TRAC:IQ:AVER ON") 'Switch on I/Q averaging
CALL InstrWrite(analyzer,"TRAC:IQ:AVER:COUN 10") 'Set 10 test runs
'––––––––– Read data in binary format ––––––––––––––––––––––––––––––––––––––
...
REM ************************************************************************
Reading and Writing Files
Reading a File from the Instrument
In the following example, the TEST1.FSL.DFL file stored under C:\R_S\Instr\user is read from the
instrument and stored in the controller.
REM ************************************************************************
Public Sub ReadFile()
'––––––––– Generate variables ––––––––––––––––––––––––––––––––––––––––––––––
Dim digits As Byte 'Number of digits of
'length information
Dim fileBytes As Long 'Length of file with trace data
'in bytes
result$ = Space$(100) 'Buffer for simple results
'––––––––– Default setting of status register ––––––––––––––––––––––––––––––
CALL SetupStatusReg 'Configure status register
'––––––––– Read out file –––––––––––––––––––––––––––––––––––––––––––––––––––
CALL InstrWrite(analyzer, "MMEM:DATA? 'C:\R_S\Instr\user\TEST1.FSL.DFL'")
'Select file
CALL ilrd(analyzer, result$, 2) 'Read and store number of
digits = Val(Mid$(result$, 2, 1)) 'digits of length information
CALL ilrd(analyzer, result$, digits) 'Read and store length
fileBytes = Val(Left$(result$, digits)) 'information
FileBuffer$ = Space$(fileBytes) 'Buffer for file
CALL ilrd(analyzer, FileBuffer, fileBytes)
'Read file into buffer
CALL ilrd(analyzer, result$, 1) 'Read terminator <NL>
'––––––––– Store file to controller –––––––––––––––––––––––––––––––––––––––
Open "TEST1.FSL.DFL" For Output As #1
Print #1, FileBuffer; ' ; to avoid linefeed at
' end of file
Close #1
END SUB
REM
************************************************************************