The HP3456A is a late 1980's / early 1990's product. It still has respectable specifications as a meter, with 6 1/2 digit resolution. The instrument is old enough that the GPIB language is not SCPI, but R2D2. This tool will convert the R2D2 into human readable language. Sending commands and reading data are fairly straight forward, this meter does not support reading all of the configuration data.
Most of the GPIB commands listed in the programming section of the manual are supported. Commands can be supplied to the tool on the shell command line, from a script file, or from an internal shell-like mode. Arbitrary delays between commands can be set. Capturing multiple measurements to a file with a user supplied delay between measurements is also possible.
This tool reuses the architecture of the project #HP3455A Multimeter Command Line Control Tool . Both tools share a lot of their source code. GPIB interface tasks are handled by the linux-gpib library that is available via Source Forge and other places. Linux-gpib supports many different interface boards and dongles. For questions about which interfaces are supported by linux-gpib, please see their documentation. Development was done under Fedora 41 and tested on several other Fedora versions. You must install the linux-gpib package before building this tool.
Both the linux-gpib library and the National Instruments NI488-2 libraries are compatible with each other with minor exceptions. It is possible to build this package to run under Windows using the NI488-2 library. Instructions to do so can be found in the AA_README file included.
In order to build this project on a Linux machine, you must already have the linux-gpib package installed. There is a .h file needed at compile time and a library that is needed at link time for this package to compile successfully. Create a working directory to build the tool in and copy the .tgz file into it. Un-tar the file and type make:
> mkdir HP3456A_ctl
> cd HP3456A_ctl
> cp wherever/HP3456A_ctl_xx_xx_xxxx.tgz .
> tar -xzvf HP3456A_ctl_xx_xx_xxxx.tgz
> make
and the software should build with no errors or warning messages. Finally, copy or link the executable program to a convenient directory in your executable path like ~/bin. There should be no need to do any of these tasks as root unless you want to put the executable in a directory off the /usr tree.
The default address for the HP3456A (currently 23) is stored in the file HP3456A.h. If your instrument is not configured for that GPIB address, you can edit the file and re-compile or you can use the -d command line option to supply the correct address.
Typing ./HP3456A_ctl with no parameters will give you a command listing:
Usage: HP3456A_ctl [-d dev_addr] CMD1 [arg1] [CMD2]...
where CMDn [argn] is one of:
HELP [cmd_name]
READ_CMDFILE cmdfilename
INTERACTIVE [TOLERANT]
SLEEP_MS NmilliSeconds
GET_MEAS No Parameters
SET_MODE DC_VOLTS/AC_VOLTS/AC_PLUS_DC_VOLTS/OHMS_2W/OHMS_4W/
DC_DC_RATIO/AC_DC_RATIO/OHMS_2W_OC/OHMS4W_OC/VDC/VAC/VACPDC
OHMS2/OHMS4/RDCDC/RACDC/VACPDC/OHMS2_OC/OHMS4_OC/TEST
SET_RANGE 0.1/1/10/100/1000/10000/100000/1000000/1K/10K/100K/1M/AUTO
SET_TRIGGER_SOURCE INT/EXT/SGL/HOLD
AUTOZERO ON/OFF
FILTER ON/OFF
SET_MATH OFF/PASS_FAIL/STATISTIC/NULL/DBM/THERM_F/THERM_C/SCALE/PCT_ERROR/DB
STORE_REG RDG_PER_TRIG/N_DIGITS/PCYCLES/DELAY/MEAN/VAR/COUNT/LOWER/
R_REG/UPPER/Y_REG/Z_REG value
RECALL_REG A_REG/RDG_PER_TRIG/N_DIGITS/PCYCLES/DELAY/MEAN/VAR/COUNT/
LOWER/R_REG/UPPER/Y_REG/Z_REG
READING_STORAGE ON/OFF
SYS_OUTPUT_MODE ON/OFF
DISPLAY ON/OFF
PACKED_OUTPUT_FMT ON/OFF
ISSUE_HOME No Parameters
GET_FRONT_REAR_SW No Parameters
SET_STATUS_MASK Value 0..0xFF
DATA_RDY_RQS ON/OFF
FETCH_TO_FILE Num dwell_ms Filename
FETCH_TO_FILE_HS Num dwell_ms Filename (Handshake Version)
SHOW_MSG_BLOCK No Parameters
DEV_CLR No Parameters
DEV_LOCAL No Parameters
GRP_TRIGGER No Parameters
SERIAL_POLL [DISP]
SHOW_RESPONSE cmdstring
SEND_CMD cmdstring
The configuration options (starting with -) must all be before the first command.
HELP without a command shows this same list of commands. With a command, it shows the command name followed by any arguments required (the same as the list shown above) .
READ_CMDFILE allows reading multiple commands from a text file. This is a "system command" . Most messages shown will indicate the line number of the file to make it easier to find and fix script problems. Commands are sent to the HP3455A as they are encountered. Any errors in commands or parameters or instrument responses will terminate the command file execution.
INTERACTIVE {TOLERANT] allows running multiple commands without the program disconnecting from the meter. This means that you don't have to prefix each meter command with the program name. The default mode of error handling is to exit the program on finding an error. If you add the TOLERANT option, you get the error messages, but the program continues in INTERACTIVE mode. This is useful to avoid aggravation if one is not a "precision" typist :). Commands are sent to the HP3456A as they are encountered. This is a "system command".
SLEEP_MS inserts a delay between commands. Most GPIB instruments are not especially fast by modern standards, so command files will usually need a delay of 10 to 100mS inserted between commands. Delays are generated in the Linux operating system and are not super accurate. This is a "system command".
GET_MEAS reads the last conversion value from the meter as one would expect.
The next 13 commands are meter specific commands.
SET_MODE sets the measurement mode of the meter. There are two different parameter words for each mode, the one matching the HP documentation and a shorthand version. Some of the measurement modes are fairly complex and are explained in the HP docs.
DC_VOLTS / DCV
AC_VOLTS / ACV
AC_PLUS_DC_VOLTS / VACPDC
OHMS_2 / OHMS2
OHMS_4 / OHMS4
DC_DC_RATIO / RDCDC
AC_DC_RATIO / RACDC
OHMS_2W_OC / OHMS2_OC
OHMS_4W_OC / OHMS4_OC
TEST
SET_RANGE sets the measurement range. This is shown according to the HP docs but is slightly confusing. For example, the HP docs show a range of 1 Volt, but the meter actually reads up to 1.99999 Volts in this scale.
SET_TRIGGER_SOURCE selects the source or the mode for conversion triggering. INT source is internal triggering. EXT source accepts TTL level trigger pulses through a BNC connector on the back panel. SGL mode is single conversion mode. It may be triggered with the Trigger button on the front panel, or by sending another SGL command on the GPIB. HOLD disables triggering until changed to another mode.
AUTOZERO enables or disables the autozero during measurements.
FILTER enables or disables the low frequency filter during measurements.
SET_MATH controls mathematical operations that the meter is capable of performing on measured data.
STORE_REG sets the specified register to your value. Several important aspects of measuring are controlled through this command.
RECALL_REG puts the specified register contents into the current display. The A_REG can be used to return the meter to measuring after looking at a different register. Technically, it can be written with the STORE_REG command, but that did not seem useful, so that is not supported. Strangely, RECALL_REG is the only mode read back command that the meter supports. It would have been nice if the meter could return other setup data like the measurement mode or range setting, but it cannot.
READING_STORAGE enables or disables storing measurement data to internal memory on the meter.
SYS_OUTPUT_MODE ON/OFF
DISPLAY seems like it should turn the display on and off, but it didn't. Included for completeness.
PACKED_OUTPUT_FMT turns the packed output format on or off. Using this mode would decrease the time needed to transfer measurement data if I had written the code to receive packed mode. At this time, I have not, so it is not useful.
ISSUE_HOME sends a software reset command to the meter, returning everything to a known state.
GET_FRONT_REAR_SW returns the state of the FRONT/REAR switch on the front panel of the meter. There are input binding posts on both the front and rear panels of the meter, and that switch selects which set is active.
SET_STATUS_MASK allows setting the GPIB Status bit mask. The HP documentation lists the bit values in octal, but the world has moved to hexadecimal, so this command accepts a hexadecimal value for the mask.
DATA_RDY_RQS enables or disables the "Data Ready" status into the status byte. Useful for handshaked trigger, wait, read operation of the meter.
FETCH_TO_FILE allows capturing multiple measurements to a file. You specify the Number of measurements to capture, the Dwell time between measurements and the Name of the .csv file to put the data in. The Dwell time is not terribly accurate and the meter is not very fast. In some configurations, the meter can take 1 second or more per conversion. Read the HP docs to understand this more. This command waits the specified dwell time after triggering a conversion before reading the data. It does not check to see that the conversion is complete.
FETCH_TO_FILE_HS is the version of the command that uses handshaking to wait for the conversion to complete, then waits the Dwell time before triggering another conversion.
SHOW_MESSAGE_BLOCK displays the contents of the internal structure that stores commanded configuration. The internal message block structure is completely handled in the parse_and_exec code, so the low level library for the meter in HP3456A.c and .h know nothing about it. The commands in parse_and_exec store values corresponding to commanded configuration changes. Note that the internal message block structure gets reset each time the program starts, so it's use is mostly for executing from a script file or interactive mode. My intention for it was to use it's contents to calculate the conversion time for the FETCH_TO_FILE commands, but the documentation did not provide enough information to complete that. This is mostly a debug command at this time.
DEV_CLR issues the low level GPIB device clear command.
DEV_LOCAL issues the low level GPIB device to local command.
GRP_TRIGGER issues the low level GPIB trigger command. Contrary to the naming, it is not the Group trigger.
SERIAL_POLL issues the low level GPIB serial poll command to return the meter status. Include the DISP parameter to parse the contents of the status byte to the screen. You must set the status mask in the meter to a non-zero value to get anything other than 0 back from the meter.
SHOW_RESPONSE is a debug command. It lets you send an arbitrary string to the meter and displays the response in Hex values and ASCII. The only responses from this meter are the contents of the display.
SEND_COMMAND is a debug command. It lets you send an arbitrary string to the meter without attempting to fetch a response.
Commands may be entered in upper or lower case.
Multiple commands may be entered on the shell command line:
> HP3456A_ctl set_mode dc_volts sleep_ms 25 set_range 10 sleep_ms 25 get_meas
will set the meter to read DC volts with a range of +/- 10 volts and return one reading with 25mS pauses between steps.
The same can be done in a command file. Create a text file foo.txt containing:
set_mode dc_volts
sleep_ms 25
set_range 10
sleep_ms 25
get_meas
Run the command file:
> HP3456A_ctl READ_CMDFILE foo.txt
and the same operations will be done.
One of the main uses for the INTERACTIVE mode is when this program is run by exec'ing if from another program. Piping stdin and stdout from this program in INTERACTIVE mode allows the calling program full control over the HP3456A.
It is usually necessary to insert short delays between commands when executing them from a file, as the control processor in the HP3456A is not especially fast. I think it is a Motorola 6800 running at 1 or 2 MHz.
The software is written in layers. The main function opens the GPIB interface and calls the parse_and_exec () function that parses the instrument commands. In the parse_and_exec.c file, the individual instrument commands get their parameters parsed and then call low level commands in HP3456A.c that assemble the outgoing strings, communicate with the GPIB driver and fetch results. There are a few low level GPIB commands that are issued from the gpib_stuff.c/.h files. The low level file (HP3456A.c and .h) could be used in a GUI driven program with the GUI software calling the low level command handling functions.
The low level functions have been used successfully for exploring the behavior of a solar panel for future projects. A separate program that included the low level command libraries for an electronic load box and a temperature sensor was written to measure panel output voltage and current while sweeping the load current every few minutes and storing the results to a .csv file. This allowed determining what the Maximum Power Point is and panel voltage/current throughout the day as the sun moves across the sky. This kind of higher level use is what I really wrote the low level command libraries for and the text based user interface is a dressy way to test these libraries. After writing one of these for my oscilloscope, I found that it was useful in general lab work and have continued the series. This is probably the last of this series.