I'm very new to VB .NET and Measurement Studio, so please forgive me if this gets confusing.
I want to create a very simple program using the VISA class library that will query a spectrum analzyer and display the results of that query in a textbox. The code is as follows:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mySession As MessageBasedSession = CType(ResourceManager.GetLocalManger().Open(GPIB0::18::INSTR), MessageBasedSession)
TextBox1.Text = mySession.Query("IDN?\n")
mySession.Dispose()
End Sub
When I run the program, I get a "Query Unterminated" on the spetrum analzyer and then the program terminates due to a timeout experiration on the Query(). What is going on?
Also, what is the difference between the synchronous/asynchronous methods (i.e. BeginRead/Read, BeginWrite/Write), and which ones should I be using?
Once I can understand the fundamentals, I would like to create another program that will capture the display on the specan and plot the points on a WaveformGraph. Here is a snippet of code that I will be using:
Dim s As String
mySession.Write("TDF P;TRA?")
Dim traceA As String = mySession.ReadString()
Dim TraceArray() As String = traceA.Split(Chr(44))
For Each s In TraceArray
WaveformGraph1.PlotYAppend(Double.Parse(s))
Next
mySession.Dispose()
Is this somewhat correct? Any help is greatly appreciated. Thanks!
Aaron