Sena PS410 Serial Server: Capturing HP 8591 Screen Images

The objective is to capture screen shots from the HP 8591 spectrum analyzer, now connected to Serial Port 2 of the Sena PS410 serial server.

My analyzer is an old one with a 3322A serial number, so its Opt 023 came with a genuine DB-25 female connector, not the DE-9 male connector described in the HP doc for the later Op 043 hardware. With that in mind, the HP doc says the spectrum analyzer supports only hardware handshaking:

  • Baud rate 300 to 57,000 baud.
  • 8 bits per character.
  • 1 stop bit.
  • No parity.
  • Software handshake – none.
  • Xon/Xoff and ENQ/ACK not supported by the spectrum analyzer.

The manual enumerates the handshaking lines:

  • Request to send (RTS) – Output signal indicates that the spectrum analyzer is ready to communicate. This line is true at power-up and stays true while power is on.
  • Clear to send (CTS) – Input signal indicates that the external controller is ready to receive data.
  • Data terminal ready (DTR) – Output signal from the spectrum analyzer. When the input buffer is full, this line goes false.
  • Data set ready (DSR) – Is not available.
  • Data carrier detect (DCD) – Input to the spectrum analyzer. If DCD is true, the spectrum analyzer will receive data from the controller. If false, no data will be input. The data will be ignored.

Furthermore, it is written:

The spectrum analyzer checks its CTS input before transmitting data to the computer. If the CTS line is false, the spectrum analyzer will not transmit data. The spectrum analyzer transmits data when the CTS line is true.

The spectrum analyzer sets the DTR line (PC CTS) false when its input buffer is full.

They offer several wiring diagrams, none of which correspond to the hardware on my bench, but swapping the “Personal Computer” and “Analyzer” headings on this diagram seems close to reality:

HP 8591 - RS232 DB25 to DE9 wiring diagram
HP 8591 – RS232 DB25 to DE9 wiring diagram


On the other end of the cable, the PS410 does “hardware flow control using RTS/CTS”. They also offer a diagram:

Sena PS410 - RS232 wiring diagram
Sena PS410 – RS232 wiring diagram

So I rewired the cable thusly:

HP 8591 vs Sena PS410 - RS232 cable diagram
HP 8591 vs Sena PS410 – RS232 cable diagram

Pin 1 on the 8591 interface connects to both frame ground and signal ground and, back when I first made this cable, many years ago, I had wired it to the shield of the cable and thence to the DE9 shell. Alas, the PS410 took offense; for reasons I don’t understand, a shell-to-ground connection ignites a ferrite bead on the PS410’s PCB.

With the rewired cable in hand, the PS410 serial port setup looks like this:

Port 2 - 8591 serial config
Port 2 – 8591 serial config

The PS410 apparently wiggles its RTS output after every byte it receives, because the CTS input at the 8591 turns into a blur during screen captures. This seems unaffected by the Inter character time-out setting and doesn’t (seem to) produce any problems, so it’s like that and that’s the way it is.

Using 9600 b/s isn’t as slow as you might think. The HP manual  notes:

Some of the programs in this manual use 1200 baud for proper operation. If your system uses the RS-232 handshake lines, you can use 9600 baud for all of the programs.

I tried 19200 b/s and got mysterious errors that resemble overruns, which suggests the 8591 ignores the PS410’s flickering RTS output. The screen dumps require only a few seconds, so it’s not a big deal, although timing issues have a way of resurfacing at the most inopportune, uh, times.

Kermit knows how to handle network sockets and suchlike, so aiming it at the spectrum analyzer is a one-liner:

set host 7002 /raw-socket
set modem none

The /raw-socket disables Kermit’s default Telnet interface, preventing it from squirting IAC + BRK characters when closing the session; I think that’s what happens, but I don’t use Telnet enough to know better. As you might expect, the 8591 deals poorly with characters outside its lexicon.

It’s not obvious set modem none does anything in this context, but it seems reasonable.

Then the rest of the script Just Works:

FM 104.7 MHz peak hold
FM 104.7 MHz peak hold

Which is the peak-hold spectrum of a local FM station, as received through an amateur radio HT rubber duck antenna.

The Kermit source code as a GitHub Gist:

#!/usr/bin/kermit +
# Fetches screen shot from HP8591E spectrum analyzer
# Presumes it's set up for plotter output...
# Converts HPGL to PNG image
# use raw-socket to disable telnet termination chars
set host 7002 /raw-socket
set modem none
# Make sure we have a param
if not defined \%1 ask \%1 {File name? }
set input echo off
set input buffer-length 200000
# Tell it what size to plot
echo Triggering plot output...
output plot 0,0,60000,40000;
log session "\%1.hgl"
# Wait for end of data stream
input 400 SP;
echo ... HPGL data captured
close session
echo Converting HPGL in
echo --\%1.hgl
echo to PNG in
echo --\%1.png
run hp2xx -q -m png -c 1436 "\%1.hgl"
echo Cropping and resizing
#run mogrify -crop "515x395+0+0!" "\%1.png"
run mogrify -density 300 -resize 200% "\%1.png"
echo Finished!
exit 0
view raw gethp8591 hosted with ❤ by GitHub

3 thoughts on “Sena PS410 Serial Server: Capturing HP 8591 Screen Images

  1. That’s some truly horrifying typesetting. Is the SA to blame, or hp2xx’s conversion?

    1. It’s pretty close to what’s on the screen, right down to the shape of the letters. The outlines over on the right mark inverse-video blocks for the activated function key, which seems like a reasonable compromise.

      For reasons I cannot explain, the spectrum analyzer emits HPGL that produces much better graphics than the scope!

Comments are closed.