Products > Test Equipment
Tek TDS Hardcopy GPIB C
<< < (3/3)
davorin:
Looks nice :-))

My 9354AL and 9414 don't feature nice colors...only different pen codes for channels in HPGL mode..that's all (o;

I see that you never write anything to the device....as I always write first to send the HCSU and then trigger it remotely via SCDP...

But good to have also some nice example written in C....as I'm working now on the OSX driver side for S82357/F82357 adapters...

EVlab:
Dear all.

I have enhanced my little program with screen dump capability of my Tek 11801.
This variant does not wait for a "SCREEN COPY" button to be pressed on the scope.
Instead it will setup and grab the screen contents remotely via GPIB when you call the binary.

Best regards, Simon
bang007:

Hi guys,

I  try to write a script in python to save the screenshoot in a png file but I get some errors. If any body can have a look on this. I am new in Python.
Many thanks for your help.


--- Code: ---import visa

rm=visa.ResourceManager('@py')
scope = rm.open_resource('GPIB::6::0')

scope.write('HARDCOPY:FILENAME "test.png"')
scope.write('HARDCOPY:FORMAT PNG')
scope.write('HARDCOPY:LAYOUT LANDSCAPE')
scope.write('HARDCOPY:PORT GPIB')
scope.write('HARDCOPY START')

raw_data=scope.read()

fid=open('/home/pi/test.png','wb')
fid.write(raw_data)
fid.close()

--- End code ---

And I got this error

--- Quote ---File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/pyvisa/resources/messagebased.py", line 312, in read
    message = self.read_raw().decode(enco)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 1031: ordinal not in range(128)

--- End quote ---
davorin:
No need to post in two separate threads (o;

Think I already posted my screen dump code somewhere here....but here it is again:


--- Code: ---#!/usr/bin/python

import sys
from subprocess import Popen, PIPE
import errno
import shlex

hpgl = ""
hp2xx = "/usr/bin/hp2xx -m png -c 12445611 -d 150 -D 90 -q -f "
cat = "/bin/cat"

from Gpib import *

file_name = sys.argv[1]
hp2xx += file_name
hp2xx += ".png"

p = Popen(shlex.split(hp2xx), shell=False, stdin=PIPE)

bytes = 200

inst = Gpib(0,1)

inst.write("HCSU DEV,HP7550A")
inst.write("SCDP")

p.stdin.write(inst.read(bytes))
count = 0

while inst.ibcnt() == bytes:
print 'Bytes read: ',count
p.stdin.write(inst.read(bytes))
count += bytes

print '\nFinished dumping...        '

print hp2xx

p.stdin.close()
p.wait()
--- End code ---

Most difficult was to find out how to launch the external hp2xx program in a shell and write the screen dump to stdout...but you won't need this as you dump a bitmap image...

icezebra:
Not all heros wear capes...
https://www.eevblog.com/forum/testgear/tds460-hardcopy/msg3571877/#msg3571877

http://mkelzenb.caltech.edu/software/TDSHC/index.html
Thanks Mike, you rock.
Navigation
Message Index
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod