04-21-2020 11:43 PM
I am writing a VB NET program for my Siglent spectrum analyzer. Admittedly I am a VB Net newbie but I have communications working well. Next I wanted to start playing with trace data. For example I use a Siglent command for getting screen trace data:
mbSession.RawIO.Write(":TRACe?")
str As String = mbSession.RawIO.ReadString()
I am only getting str lengths of 1024 bytes. Using NI Max and checking by adjusting buffer size, the TRACe? command returns about 20,000 bytes of data and the size will vary depending on the spectrum analyzer function. Is there some method to use RawIO.ReadString() to read the entire data string stream? In VB Net declaring str as string should allow it to become any string length up to >1 Mbyte. Is the 1024 byte limit a RawIO.ReadString() issue??
Any advice would be greatly appreciated.
Jerry
04-22-2020 07:32 AM - edited 04-22-2020 07:54 AM
I realized I wasn't being clear. Per the IVI specs, str = mbSession.RawIO.ReadString() should be Synchronous and read the entire string before completing. I found that I can set the read length arbitrarily by including a length int64:
str = mbSession.RawIO.ReadString(21000)
My problem is the length will vary substantially. Whats the most efficient and fastest way of doing this? For a real time instrument interface, I would want to read the trace data and display it graphically many times a second.
11-11-2020 02:31 PM
Hi, sorry to bother, I am extremely new to this Visa programming in VB (I have done it in python but this is way different) and I am having a lot of problems getting queries from the device, I have been able to connect to it and (I think) open the session but I am not able to send any command to it (I am just trying with the "*IDN?"), this is some of my code
Imports NationalInstruments.Visa
Public rm As New ResourceManager
I am able to find the device and put it on a Combo Box
Dim lista1() As String = rm.Find("(ASRL|GPIB|TCPIP|USB)?*")
I take the selected device from the Combo Box
Dim aparato As String = ComboBox1.Text()
"Open" the device (I don't know if it is correctly defined)
Dim el_aparato As Object = rm.Open(aparato)
And then I try to get the response from it
Dim respuesta As String = el_aparato.Parse("*IDN?")
I really, really appreciate if you could help me out
For any reply thanks.
12-11-2020 06:56 AM
Just a thought, have you set the termination character?
i.e. mbSession.TerminationCharacter = TermChar
where TermChar As Byte = 63 for a "?" as it appears in your example.
Hope that helps.