2

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.

success
  • 75
  • 2
  • 11

1 Answers1

1

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.

djv
  • 15,168
  • 7
  • 48
  • 72
  • Note that while in this case, the commands are in the "Operating Manual", sometimes an instrument's commands are not in it's operator's (or user's) manual but in a separate programmer's manual. – Jeanne Pindar Jul 07 '16 at 20:47
  • Noted. Updated my answer. – djv Jul 07 '16 at 21:49
  • Thank you Verdolino and Jeanne, I now get the hang of it. I actually found that manual that Verdolino pointed out before I posted the question. I tried the those command in the VISA TEST Panel in the Measurement & Automation Explorer but it does not; however it does work in the visual studio. I want to point out that Write does not return anything, so I can leave the "result = " out – success Jul 07 '16 at 23:50
  • [my first comment has grammar error but weird enough Stackoverflow does not want me to change so I post the grammar erro free version] Thank you Verdolino and Jeanne, I now get the hang of it. I actually found that manual that Verdolino pointed out before I posted the question. I tried those command in the VISA TEST Panel in the Measurement & Automation Explorer but some does not work; however it does work in the visual studio. I want to point out that Write does not return anything, so I can leave the "result = " out – success Jul 07 '16 at 23:59
  • That's my mistake. It should be Query, as you had in your example. I changed my example – djv Jul 08 '16 at 00:46