vb.netvisagpib

How do I write VB.NET program to remotely control 6060B (electric load)


I am writing a vb.net program to remotely control the 6060B (electric load). So far I have successfully connected my pc to the 6060B and I am able to query information from the load. Below is the part of the code I wrote:

Dim mbSession As MessageBasedSession;
mbSession = ResourceManager.GetLocalManager().Open("GPIB::6::INSTR");
Dim responseString As String = mbSession.Query("*idn?");

This returns me the information of the load -- "responseString is HEWLETT-PACKARD...". However, I don't know what should I do to change/set the current, voltage ect just as I normally do from the panel. I search on the internet and I found that I could use HPSL programming language but what should I remotely control the 6060B using vb.net? I am using NI-VISA.NET API.


Solution

  • You need to find the command reference. There is a standard, SCPI, which has commands generally in the form

    MEASure:CURRent?
    

    Again this is a standard, and you should find the specific command reference for your device, HP (Keysight / Agilent) 6060B 300 Watt DC Electronic Load.

    A search engine result for hp 6060b manual should yield some good results. Look for an operating or programming manual which usually has the command reference.

    This should work for you:

    ' This example sets the current level to 0.75 amps
    ' and then reads back the actual current value.
    
    
    ' set input off
    mbSession.Write("INPUT OFF")
    ' set mode to current
    mbSession.Write("MODE:CURR")
    ' set current range
    mbSession.Write("CURR:RANG 1")
    ' set current value
    mbSession.Write("CURR 0.75")
    ' set input on
    mbSession.Write("INPUT ON")
    ' measure current
    Dim result As String
    result = mbSession.Query("MEAS:CURR?")
    Dim measuredCurrent As Single = Single.Parse(result)
    

    Example taken from page 70 of this operating manual I found.

    In general, things are usually easier if you are provided example code. I will usually use the example code to get a baseline working operation, then copy the code to my project and manipulate as needed.