HP545xx Data Acquisition Software

A software tool to use an HP545xx Digital Scope for Data Acquisition

Similar projects worth following
I am working on a project that needs access to multiple channels of digitized analog data, with sample rates starting at 1MS/S and going up from there. Thinking about a digital storage scope, it is a fast data acquisition system with a display screen and a front panel interface. It just needs a way to get the data out to a computer. The HP545xx family of scopes have serial and GPIB interfaces built in. They also have a command set capable of retrieving the sample data and good documentation. This is a Linux based software tool that allows downloading the sample data from an HP545xx family scope and a little bit of remote control. It uses the Linux-GPIB library to drive the GPIB hardware interface. It has been built and used under 64 bit Linux and 32 bit linux. I have worked with the HP54540C and HP54542A model scopes using this software. The HP54520 and HP54522 scopes should also work with some editing, but have not been tested.

The HP5454xx family of digital storage scopes are pretty capable tools, with the high end of the family offering 4 channels with 2GS/S sample rate and 500MHz bandwidth. Their memory depth could be better, but the 32K samples per channel is definitely adequate for what I need.

Looking through the programmers manual for the 545xx scopes, all of the front panel controls can be accessed through the external interface. There are also a few functions that are only accessible through the external interface. Writing a complete interface package for this scope would be a very large task. I am not interested in developing a fully automated test system with the scope, just getting the sample data from the scope with a few minimal functions to ease the acquisition process.

A few years ago, I wrote a tool ( #HP5454x Screen Capture  ) that connects to the serial port on the scope and emulates an HP Laserjet printer enough to capture a PCL file which can be converted to other formats readily. As a result, the scope serial port is in use. This leaves the GPIB interface as the choice for controlling the scope. One added advantage of using the GPIB interface is that I can start the print download on the scope without getting up and walking across the room to push the "PRINT" button on the scope.

When the GPIB interface is in use to control the scope, the front panel is disabled.  It is frustrating to have to go through the two button sequence on the front panel to put the scope in local mode every time you want to change the configuration from the front panel. This program is designed to execute one or two commands and then turn the control back to the front panel. This method works well for the way I use the scope. Sitting in front of the scope, manually set the scope up and get it to capture the image as I want it. The PC is on another desk, so I can move to the PC and run multiple scan and capture steps to get the data that I want.

Commands supported by this tool are:
     GET_DATA outfilename.csv
     WAIT_MS delay_MS
     COUPLING 1/2/3/4 DC/DC50/AC
     SetSerial 0123456789

RUN Start the scope acquisition in whatever MODE it is set to. I normally use MODE SINGLE for acquisition. In MODE SINGLE, the scope captures one full set of data and goes back to STOP.

STOP Don't acquire any more data. This is basically an idle mode.

MODE This is the "TRIGGER MODE" and "RUN MODE" controls for the scope. AUTO just loops continuously, acquiring data and refreshing the screen as fast as it can. TRIG is the triggered sweep mode and the scope will sit in the run state waiting for the trigger condition to be satisfied and then it will acquire new data and go back to waiting for the next trigger event. SINGLE is like the TRIG mode, in that it will wait for a trigger condition before acquiring a set of data and then go to stop mode when it is complete. Either TRIG or SINGLE will give the most stable and predictable image on the screen and in the captured data. The SINGLE mode has the advantage that if you want to print a copy of the screen in addition to downloading the data, both will have the same information.

FMT_BYTE and FMT_WORD Selects the format for the data transfer from the scope. BYTE mode is slightly faster, but WORD mode data looks a lot better. In BYTE mode, there are 7 bits of data and the sign. In WORD mode, there are 14 bits of data and the sign. FMT_BYTE or FMT_WORD must be issued before the data to download is captured. Once an acquisition run is done, you cannot change the output format without corrupting the data.

GET_DATA Requests sample...

Read more »

Fixes for error detection and handling. Added command for setting scope clock to match PC clock and displaying a short text string at the top of the scope screen. Has notes (aa_notes) on how to build for MINGW environment and how to build for Linux/unix environment.

Zip Archive - 39.60 kB - 04/20/2023 at 20:24


This file contains the changes to facilitate building this tool for the 54522 or 54520 scopes. It also has changes and instructions to allow building this tool in a MINGW/Windows environment. See the aa_notes file for details.

Zip Archive - 36.52 kB - 10/12/2022 at 18:00



Source Code for the HP54542_ctl program.

x-compressed-tar - 36.25 kB - 06/25/2022 at 23:30


  • Swapped out the Command Parser and added a lot of commands

    Bharbour09/23/2023 at 19:07 0 comments

    When I wrote the original version of this tool, I used a very simple command parser. I knew that it was not very scalable, so adding commands would get ugly. I have written several command line control tools for other instruments since this one was done, and I arrived at a parser design that I like.

    In a fit of boredom during a long, hot summer, I swapped the original parser out for the newer one. I also have added a bunch of commands. The new version of this tool has enough functionality to control a big part of the stuff I use this scope for. 

    The code is still very much Alpha stage code, but if someone is interested in it, leave a comment or PM me and I will get back to you. The amount of new code means that it is going to take some time to get all the issues worked out on it.

    The command set on this scope is truly huge. I probably have only implemented 1/4th of it, if that much.

  • 4/20/2023 Bug fix and a couple of new commands

    Bharbour04/20/2023 at 20:40 0 comments

    This zip file contains the source code to build my HP54542_ctl utility under Linux/Unix and the open source parts to build under Windows. The Windows environment needs a couple of National Instruments files that come with the NI488-2 driver package, and one Microsoft file CHKSTK.OBJ. See the previous log file for discussion on how to build.

    While working on a library for another instrument (HP5334A freq counter), I realized that the error detection that I had after each GPIB transaction was not working correctly. After some cursing and thrashing  (and testing), I believe it is correct now. I updated the code in this zip file.

    2 new commands, one to set the clock in the scope to match the one in the PC, and another to put a short text string on the screen of the scope which is useful for annotating scope shots.

  • Building under MINGW in Windows

    Bharbour10/12/2022 at 02:38 0 comments

    After digging through my old code archives (tombs?) I found the recipe for building this tool under Windows using the MINGW/msys 32 bit tool chain.

    Be sure that you downloaded the file if you want the changes that allow the program to build in the MINGW environment. The contents of this file will build in either a Linux environment (after installing the open source LinuxGPIB driver package) or the 32 bit MINGW environment under Windows. There are also some changes to make it easier to build for the HP54522 or HP54520 scopes. See the aa_notes file to build for the HP5452x family of scopes.

    There is a Microsoft file: chkstk.obj that needs to get added to the link phase in the Makefile. The ni4882.obj file also needs to get added to the link phase.

    The chkstk.obj, ni4882.obj and the ni4882.h files all need to be added into the compile directory. The ni4882.obj and ni4882.h files come from the National Instruments 488.2 driver package that you must install before doing any of this stuff. The chkstk.obj file comes from Visual Studio (I think).

    The ni4882.obj and ni4882.h files are copyright National Instruments and chkstk.obj is copyright Microsoft. These 3 files are not included in the zip file because of their copyright status.

    The NI library does not have the function   gpib_error_string () in it. The MINGW/Windows build includes a function that returns the error identification string for the iberr values.

    If you want to build this tool as a 64 bit program, you could probably do it using the free Visual Studio tool set from Microsoft. Be sure to add the -DMINGW_ENV parameter to your compile flags because that triggers some required changes to build in any Microsoft environment. Also, be sure to get the 64 bit version of the ni488-2 driver package. You are on your own for the rest of this.

    The file aa_notes has some useful stuff on compiling this program.  The AA_Readme file has stuff on using the program.

    I still don't have a 5452x family scope to test the 2 channel changes on, so those changes are still untested. The 5454x version has been used for several months with no problems seen.

  • Examples of why to use FMT_WORD instead of Default FMT_BYTE

    Bharbour07/15/2022 at 16:41 0 comments

    The HP54542 defaults to using BYTE format for transferring data. Unless you are transferring crazy numbers of data sets or need them really fast, using the WORD format results in much cleaner data. Here are two plots of similar events, one captured as BYTE data and the second captured as WORD data.

    A small signal with a DC offset captured as BYTE data
    A small signal with a DC offset captured as BYTE data
    A Similar Small Signal with a DC Offset, captured as WORD data.
    A similar small signal with a DC sffset, captured as WORD data.

  • For 54520 or 54522 users

    Bharbour07/05/2022 at 22:33 0 comments

    I went through the code and added some ifdefs to make it more likely to operate with these scopes but I have no way to test it.

    10/12/2022 Update The latest .zip file ( has the changes required to compile for the 5452x family of scopes in it.

    It also has changes to make it easier to build in a MINGW/Windows evironment using the National Instruments 488-2 driver. See the aa_notes file for details.

View all 5 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

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