Quick Start
R&S
®
ESR
135
User Manual 1175.7068.02 ─ 12
CALL InstrWrite(analyzer,"INIT;*WAI") 'Perform sweep with sync
'--------- Defining the frequency range for output -------------------------
CALL InstrWrite(analyzer,"FREQ:STARt?") 'Read start frequency
CALL InstrRead(analyzer,startFreq$, 100, retCount)
startFreq = Val(startFreq$)
CALL InstrWrite(analyzer,"FREQ:SPAN?") 'Read span
CALL InstrRead(analyzer,span$, 100, retCount)
span = Val(span$)
'--------- Reading out in binary format ------------------------------------
CALL InstrWrite(analyzer, "FORMAT REAL,32")
'Set binary format
CALL InstrWrite(analyzer, "TRAC1? TRACE1")
'Read trace 1
CALL InstrRead(analyzer, result$, 2, retCount)
'Read and store length
digits = Val(Mid$(result$, 2, 1)) 'spec. for number of characters
result$ = Space$(100) 'Reinitialize buffer
CALL InstrRead(analyzer, result$, digits, retCount)
'Read and store length
traceBytes = Val(Left$(result$, digits))
'specification
CALL InstrRead(analyzer, BinBuffer, traceBytes, retCount)
'Read trace data into buffer
CopyMemory traceData(0), ByVal BinBuffer, traceBytes
'Copy data into float array
'--------- Outputting binary data as frequency/level pairs -----------------
traceValues = traceBytes/4 'Single precision = 4 bytes
stepsize = span/traceValues 'Calculate frequency step size
For i = 0 To traceValues - 1
Debug.Print "Value["; i; "] = "; ststepsize*i; ", "; traceData(i)
Next i
'--------- Default setting of zero span ------------------------------------
CALL InstrWrite(analyzer,"FREQ:SPAN 0Hz")
'Switch to zero span
CALL InstrWrite(analyzer,"INIT;*WAI") 'Perform sweep with sync
'--------- Reading out in ASCII format -------------------------------------
CALL InstrWrite(analyzer,"FORMAT ASCII")
'Set ASCII format
CALL InstrWrite(analyzer,"TRAC1? TRACE1")
'Read and output
CALL InstrRead(analyzer, asciiResult$)
Print "Contents of Trace1: ",asciiResult$ 'trace 1
END SUB
REM ************************************************************************
3.6.2.4
Storing and Loading Instrument Settings
Settings and measured data can be stored and loaded. You can define which data set
is loaded when the instrument is preset or started.
Brief Introduction to Remote Control