Specifications

Chapter 16 195
ESA/PSA Programming Examples
Using Visual Basic® 6 to Transfer Binary Trace Data
ESA/PSA Programming Examples
Print the IDN string results in a message box
MsgBox (strRes)
Change the instrument mode to Spectrum Analysis
status = viVPrintf(vi, ":INST:NSEL 1" + Chr$(10), 0)
If (status < 0) Then GoTo VisaErrorHandler
Set instrument trace data format to 32-bit Real
Note: For higher precision use 64-bit data, ":FORM REAL,64"
For faster data transfer for ESA, use ":FORM INT,32"
status = viVPrintf(vi, ":FORM REAL,32" + Chr$(10), 0)
If (status < 0) Then GoTo VisaErrorHandler
Set Analyzer to single sweep mode
status = viVPrintf(vi, ":INIT:CONT 0" + Chr$(10), 0)
If (status < 0) Then GoTo VisaErrorHandler
Trigger a sweep and wait for sweep to complete
status = viVPrintf(vi, ":INIT:IMM;*WAI" + Chr$(10), 0)
If (status < 0) Then GoTo VisaErrorHandler
Query the trace data from the instrument
Note: Change the "%#zb" to "%#Zb" for Real,64 data
For Int,32 leave the modifier as "%#zb"
status = viVQueryf(vi, ":TRAC:DATA? TRACE1" + Chr$(10), _
"%#zb", ArrayPtr(0))
Close the vi session and the resource manager session
Call viClose(vi)
Call viClose(defrm)
Print number of elements returned
MsgBox ("Number of trace elements returned = " & length)
Create a string from the ResultsArray to output to a file
For x = 0 To length - 1