AnsweredAssumed Answered

34972A, VB.NET Measurements and some Problems...

Question asked by malibu233 on Jul 2, 2011
Latest reply on Jul 3, 2011 by malibu233
Hi Guys,

at the moment it's nearly 2am here in Germany, and i spent the whole day with some strange measure problems.
So, i am using the 34972A Unit with 34901A, 34903A and 34907A Modules.
The Unit is connected to my PC via USB, i am coding my Application with Visual Studio in VisualBasic.NET.
The connection works good and i can use the Instrument basically in my Program.

But i've got 2 problems:


If i take voltage or current measurements, in some cases the unit returns valid data (i.e. "1.4323..+E01") and in the other it returns completely nothing (String in VB.NET is empty), the results are read in the "rdgs" string in code below.
The complete execution is done with viPrintf and viScanf Funktions via visa32.dll
I've tried this measurement once with the "MEAS:CURR:AC? (@121)" and then with "CONFIG:CURR:AC (@121)", "ROUT:SCAN (@121)", "INIT" and then the "FETC?" command.
In both ways, the result is the same (described above).

When i do these commands with Agilent Interactive IO, this command is executed perfectly and the result is shown.

Wheres the problem with my way?


The returned AC current data in the Interactive IO Windows (i use MEASure and the other way with "config" "route" "init" and "fetc?" again) is every query correct.
But in my program, this result changes without any reason from about 14mA (which is correct) to over 200mA.
There are no resulotion or range limitations, so the unit operates completely automatic.

The measure at the unit itself is the same with the Interactive IO Windows, so correct all the time.

Heres the basic code:

Public Sub Meas_Volt()

        Dim rdgs As String
        Dim readString_volt As System.Text.StringBuilder = New System.Text.StringBuilder(1000)
        Dim sendestring As String

        viError = viPrintf(session, "CONF:CURR:AC (@121)" & vbLf)
        viError = viPrintf(session, "ROUT:SCAN (@121)" & vbLf)
        viError = viPrintf(session, "INIT" & vbLf)

        viError = viPrintf(session, "FETC?" & vbLf)

        viError = viScanf(session, "%s", readString_volt)
        rdgs = readString_volt.ToString

End Sub