I have found plenty of examples of how to capture the trace using VB6, but nothing utilizing VB.net.
Only viScanf is available for VB.net
How do I grab the trace using viScanf?
Only viScanf is available for VB.net
How do I grab the trace using viScanf?
Here’s an example how to use VISA-Com to read back the ID string from the analyzer in VB.NET.
Dim status As Long
Dim idn As String
Dim drm as Ivi.Visa.Interop.ResourceManager
Dim vi as Ivi.Visa.Interop.FormattedIO488
drm = New Ivi.Visa.Interop.ResourceManager
vi = New Ivi.Visa.Interop.FormattedIO488
'Attempt to connect to the Signal Analyzer
Try
vi.IO = drm.Open("GPIB0::18::INSTR")
Catch ex As Exception
Return False
End Try
'Get IDN String from the analyzer
status = vi.IO.WriteString("*IDN?" + Chr(10))
If status < Ivi.Visa.Interop.VisaStatusCode.S_VISA_SUCCESS Then
Return False
End If
idn = vi.IO.ReadString(100)
To additionally read back the trace data, you can do this two ways. You can change the data format to Real,64 and do a binblock read of the data. You can also, read back the data as an ASCII string of comma separated data. The binblock read is much faster.
Here’s basically how you would read back the trace data in binblock format in C#. You can convert this code to VB.NET
SA.WriteString("INIT:CONT OFF\n"); // put the analyzer in single sweep
SA.WriteString("FORM:DATA REAL,64\n"); // set the data type to binblock real,64
SA.WriteString("INIT:IMM;*OPC?"); // take a sweep and wait for the sweep to complete
Double opc = SA.Readnumber(IEEEASCIIType.ASCIIType_UI1, true); // read back 1
SA.WriteString(“TRACE:DATA? TRACE1”);
double[] trace = new double[1000];
trace = SA.ReadIEEEBlock(IEEEBinaryType.BinaryType_R8, true);
Regards -