lecroy screencaptures via prologix usb-gpib converter on linux

lecroy screencaptures via prologix usb-gpib converter on linux

This is not fancy, flexible, or robust. It configures a prologix usb-gpib converter to grab screen captures from a LeCroy 94xx or 93xx oscilloscope, store the resulting HPGL into a file, and convert that file to a .png using the HP2xx conversion program.
You need to have pyserial and HP2xx installed. Both are available through repos.
Usage: sudo python screencapture.py [/dev/tty of usb converter] [gpib address of scope, which has to be between 2 and 30, because lecroys behave weirdly outside that range.]
This should work with early Waverunners like the LT3xx series. I have not yet gotten it to work but that’s a setup issue with the Prologix. A Waverunner will need a much larger buffer. The Mad Scientist Hut.
To do: use a serial.inwaiting loop to only use as much buffer size as needed.
I’m also incompetent at posting code on wordpress apparently, so you can go to github: lecroy scope screencap on github

import os.path
import serial
import sys
import subprocess

if __name__ == ‘__main__’:

if len(sys.argv) != 3:
print “Usage: “, os.path.basename(sys.argv[0]), ”


comport = sys.argv[1]
addr = sys.argv[2]
ser = serial.Serial()

ser = serial.Serial(sys.argv[1], 9600, timeout = 2.0)
print(“Setting up usb-gpib device”)
ser.write(‘++mode 1\n’)
ser.write(‘++addr ‘ + addr + ‘\n’)
ser.write(‘++auto 1\n’)
print(“Setting up scope screen plot parameters”)
ser.write(‘HCSU port,gpib,dev,hp7470a,pens,4\n’)
print(“Acquiring screen capture”)
s = ser.read(65536)
f = open(“scope_output.txt”,”w”)
print(“Done writing to file! Using HP2xx to convert to png image.”)

print(“Finished converting image to png”)
except serial.SerialException, e:
print e

except serial.KeyboardInterrupt, e:
print e

Leave a Reply

Your email address will not be published. Required fields are marked *