The HP5334 frequency counter is a fairly old instrument, dating back to the late 1980's. The GPIB interface language predates the SCPI language that is in common use now. The old GPIB language is referred to as R2D2 language and is not particularly human readable. This tool translates human readable commands into and out of the old language. It also has functions to capture large numbers of data samples and store them to a .csv file for later use.
The architecture used in this tool is the same as the architecture used by my #HP E3634A Power Supply Control Software project. Both tools share a lot of the same code. These tools were developed to use the linux_gpib library and have been tested on multiple versions of Fedora Linux. You must install the linux_gpib library before attempting to build this tool.
Both the linux_gpib library and National Instruments NI488-2 libraries are pretty much compatable with each other. There are a few minor differences that are described in detail in my project #HP545xx Data Acquisition Software including how to build this software to run on a Microsoft operating system.
In order to build this project for Linux, install the linux_gpib library on your machine. There is a .h file that is used by the code and a library file that is required at link time in the linux_gpib package. Next, create a working directory to build the software in and un-tar the source file, then run make:
> mkdir HP5334_tool
> cd HP5334_tool
> tar -xzvf ../HP5334_ctl_6_1_2023.tgz
and the software should build with no errors or warning messages. Finally, copy 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.
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:
Usage: HP5334_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_FREQUENCY A/B/C
- GET_PERIOD_A no parameters
- GET_TRIGGER_LEVELS no parameters
- GET_PEAK_VOLTS no parameters
- SHOW_HEX_RESP CmdString
- GET_MULTIPLE_PERIOD_A Nvalues Tdwell Outfilename
- GET_MULTIPLE_FREQUENCY A/B/C Nvalues Tdwell Outfilename
- GET_INTERVAL_ATOB no parameters
- GET_INTERVAL_ATOB_DELAY no parameters
- GET_RATIO_ATOB no parameters
- GET_TOTAL_STOP_A no parameters
- GET_PULSE_WIDTH_A no parameters
- GET_DVM_VOLTS no parameters
- GET_RISE_FALL_TIME no parameters
- SEND_INIT no parameters
- GET_ERROR no parameters
- SET_INPUT_COUPLING A/B DC/AC
- SET_INPUT_SLOPE A/B +/-
- SET_INPUT_ATTEN A/B X1/X10
- SET_INPUT_TERMINATOR A/B
- ON/OFF SET_TRIGGER_LEVEL A/B Volts
- SET_AUTO_TRIGGER ON/OFF
- SET_INPUT_COMMON ON/OFF
- SET_INPUT_FILTER ON/OFF
- SET_SENSITIVITY_MD ON/OFF
- SET_DACS ON/OFF
- SET_START_EXT_ARM_SLOPE +/-/OFF
- SET_STOP_EXT_ARM_SLOPE +/-/OFF
- SET_SINGLE_CYCLE_MD ON/OFF
- SET_100_GATE_AVG_MD ON/OFF
- SET_GATE_TIME Tseconds
The configuration options (starting with -) must all
be before the first instrument command.
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_period_a works as well as GET_PERIOD_A.
> HP5334_ctl SET_INPUT_ATTEN A X10 SET_INPUT_FILTER OFF SET_AUTO_TRIGGER OFF
will set the input X10 attenuator on channel A, turn off the input filter and the auto trigger options.
A text file with commands in it can also be used with the READ_CMDFILE command. If you created a text file cfg_chA containing:
SET_INPUT_ATTEN A X10
SET_INPUT_COUPLING...Read more »