Close
0%
0%

HP E3634A Power Supply Control Software

A command line tool to control an HP Power Supply via Linux_GPIB

Similar projects worth following
This is a command line driven tool to control an HP E3634 or E3633 power supply via the GPIB interface. It uses the Linux_GPIB driver and library, so all GPIB interface devices supported by Linux_GPIB should be usable. Coding is done in ANSI C on the Linux platform. This project is still in the Beta stage, it has had some testing and some use, but not extensive testing or use.
Source code is included so that you can build this tool for your own use.

Before attempting to build this tool, you must install the Linux_GPIB package first. To build this tool, create a directory to work in and unpack the tgz file into the working directory. As a normal user in the working directory, type make and the code should build with no errors or warnings. Then copy the executable file HP3634_ctl into a convenient directory like ~/bin.

The E3634 power supply defaults to address 8 and the tool is configured to default to that address. If you have changed the address for your E3634, you can supply the new address on the command line via the -D option:
> HP3634_ctl -D new_address.
If you want to change the default address, edit the default address value  DEFAULT_HP3634A_ADDR value in HP3634A.h.

All of the commands supported by the tool can be viewed by entering the tool with no command line parameters and the tool will respond with the list:
> ./HP3634_ctl
Usage: HP3634_ctl [-d dev_addr] CMD1 [arg1] [CMD2]...
 where CMDn [argn] is one of:

  • HELP cmd_name
  • READ_CMDFILE cmdfilename
  • SLEEP_MS NmilliSeconds
  • GET_ID    no parameters
  • GET_ERRORS    no parameters
  • SET_CUR_LIMIT i_limit_value
  • GET_CUR_LIMIT    no parameters
  • GET_MAX_CUR_LIMIT    no parameters
  • SET_OCP_LIMIT ocp_value
  • GET_OCP_LIMIT    no parameters
  • SET_OCP_STATE ON/OFF/CLEAR
  • GET_OCP_STATE    no parameters
  • SET_OUTPUT_VOLTAGE output_voltage_value
  • GET_OUTPUT_VOLTAGE    no parameters
  • GET_MAX_OUTPUT_VOLTAGE    no parameters
  • SET_OVP_LIMIT ovp_value
  • GET_OVP_LIMIT    no parameters
  • GET_OVP_STATE    no parameters
  • SET_OVP_STATE ON/OFF/CLEAR
  • SET_VOLTAGE_RANGE HI/LOW
  • GET_VOLTAGE_RANGE    no parameters
  • SET_OUTPUT ON/OFF
  • GET_OUTPUT    no parameters
  • GET_MEASURED_VOLTAGE    no parameters
  • GET_MEASURED_CURRENT    no parameters
  • SAVE_CONFIG 1/2/3
  • RECALL_CONFIG 1/2/3
  • SEND_RST    no parameters
  • GET_QSR_REG    no parameters
  • GET_QSR_CONDITION    no parameters
  • GET_STD_EVENT_REG    no parameters
  • SET_CAL_SECURE_CODE code
  • SET_CAL_SECURE_STATE OFF/ON code
  • GET_CAL_SECURE_STATE    no parameters
  • SET_CAL_STRING "cal_string"
  • GET_CAL_STRING    no parameters
  • GET_CAL_COUNT    no parameters
  • SET_CAL_CURRENT current value
  • SELECT_CAL_CURRENT MIN/MID/MAX
  • CAL_CURRENT_PROTECTION no parameters
  • SET_CAL_VOLTAGE current value
  • SELECT_CAL_VOLTAGE MIN/MID/MAX
  • CAL_VOLTAGE_PROTECTION    no parameters
  • CAL_DAC_ERROR    no parameters 
  • The configuration options (starting with -) must all
    be before the first command.

You can also see the parameters for a single command with the -H option:
> HP3634_ctl -H SELECT_CAL_VOLTAGE
and the tool will respond with the command line options for that command:
  SELECT_CAL_VOLTAGE MIN/MID/MAX

Instrument commands may be typed on the command line. Multiple instrument commands can be on the command line and they are executed in the order of appearance. Commands are not case sensitive, so get_cur_limit works as well as GET_CUR_LIMIT.
> HP3634_ctl SET_CUR_LIMIT 1.5 SET_OUTPUT_VOLTAGE 3.3 SET_OUTPUT ON
will set the current limit value to 1.5 Amps, the output voltage to 3.3 Volts, and turn the output on.

A text file with commands in it can also be used with the READ_CMDFILE command. If you created a text file cfg_3p3 containing:
SET_VOLTAGE_RANGE LOW
SET_CUR_LIMIT 1.5
SET_OUTPUT_VOLTAGE 3.3
and then issued the following command:
> HP3634_ctl READ_CMDFILE cfg_3p3 SET_OUTPUT ON
the supply will go to the low output voltage range, set the current limit to 1.5 Amps, set the output voltage to 3.3V, and turn the output on.

Syntax for the command file is the same as the syntax for the command line with the exception that you cannot change the GPIB address in the command file.

Some error checking is done in the tool but it is possible to send a command that the E3634...

Read more »

HP3641A_tool.tgz

This is a version of the tool to drive an HP E3641A power supply.

x-compressed-tar - 24.78 kB - 12/24/2023 at 23:48

Download

HP3634_ctl_12_24_2023.tgz

Add an interactive command interpreter. Clean up help screen presentation.

x-compressed-tar - 24.93 kB - 12/24/2023 at 23:47

Download

HP3634_ctl_6_07_2023.tgz

Add line numbers to command outputs to ease debug of command files. Fix a couple of bugs. Change some command words to make them more consistent with the rest of the commands. Add comments to the gpib_stuff files to clarify what the "minor" value was used for.

x-compressed-tar - 24.57 kB - 06/07/2023 at 18:01

Download

  • New revision of the HP E3634 tool and a version for the HP E3641A

    Bharbour12/25/2023 at 00:16 1 comment

    The new revision has an interactive command added. To use it, enter:

    HP3634_ctl interactive

    This allows you to enter commands only, without exiting the tool or allowing the 3634A to drop out of remote mode between commands.  My use for this mode is to call this tool from another program using pipes and the execv call. It will exit if there are any syntax errors or other issues. Upon return from each command, the fflush () function is called to get around the wacky flow control for the pipes. It results in the parent process getting the results of the command immediately after completion.

    While working with a similar tool talking to the HP34401A multimeter, I found that the trigger stuff would not work if you allowed the meter to go out of remote mode between commands. I am not sure if the 3634A power supplies behave similarly, but the ability to exec this program from another one is useful.


    The help screen display was really messy. The parameters for each command were jumbled up to the right of the command name. I got all of the parameters to line up vertically which is more pleasing to my eye. May be easier to read maybe not...

    I picked up another GPIB capable power supply and wanted to be able to drive it with a tool like the one that drives the 3634A. The command sets are almost identical, with the exception of the 3641A not having any overcurrent protection commands. It still supports the current limit operations though. Also, the minimum/maximum voltages and currents changed. Because the 3641A commands are a subset of the 3634A commands, it seemed like ifdef'ing out big chunks would get messy, so I ported a copy of the 3634A tool to the 3641A.

    A friend has the 3 output version (E3631A) of the 3634A and there is only one additional command that power supply needs to select between the outputs. He would be interested in driving the supply from the RS232 port rather than the GPIB port, so there would be some work to change the code for that and adding the channel control command would be trivial to implement. It would be necessary to add current channel tracking to make the limit checking make sense, or just get rid of the limit checking entirely. If you enter something out of bounds for a channel, the supply will catch it and complain without accepting the bad value. If anybody else is interested in this supply, please leave me a message in the comments section or PM me.

View project log

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates