Operating instructions

More Complex Programming Examples R&S ESCI
1166.6004.12 7.38 E-1
'--------- Read out in binary format ---------------------------------------
Call ibwrt(receiver%, "FORMAT REAL,32") 'Select binary format
Call ibwrt(receiver%, "TRAC1? TRACE1") 'Read out trace 1
Call ilrd(receiver%, result$, 2) 'Read out and store
digits = Val(Mid$(result$, 2, 1)) 'number of digits of
'length information
result$ = Space$(100) 'Initialize buffer again
Call ilrd(receiver%, result$, digits) 'Read out
traceBytes = Val(Left$(result$, digits)) 'and store length information
Call ibrd32(receiver%, traceData(0), traceBytes) 'Read trace data into buffer
Call ilrd(receiver%, result$, 1) 'Read the terminator <NL>
'--------- Read out binary data as pairs of frequency/level values ---------
traceValues = traceBytes/4 'Single precision = 4 bytes
stepsize = span/traceValues 'Calculate frequency step width
For i = 0 To traceValues – 1
Print "Value["; i; "] = "; startFreq+stepsize*i; ", "; traceData(i)
Next i
'--------- Time domain default setting -----------------------------------
Call ibwrt(receiver%,"FREQ:SPAN 0Hz") Switchover to time domain
CALL IBWRT(receiver%,"INIT;*WAI") 'Perform sweep with sync
'--------- Read out in ASCII format ----------------------------------------
Call ibwrt(receiver%,"FORMAT ASCII") 'Select ASCII format
CALL ibwrt(receiver%,"TRAC1? TRACE1") 'Read out Trace 1
CALL ibrd(receiver%, asciiResult$)
Print "Contents of Trace1: ",asciiResult$ 'Output
END SUB
REM
************************************************************************