Author Topic: linux-gpib examples/utilities  (Read 2874 times)

0 Members and 1 Guest are viewing this topic.

Offline davorinTopic starter

  • Supporter
  • ****
  • Posts: 922
  • Country: ch
linux-gpib examples/utilities
« on: July 27, 2014, 09:05:26 pm »
I just got finished installing and configuring linux-gpib on my small Intel NUC for my F82357 adapter...

Apparently linux-gpib exists since a long, long time...but surprisingly there aren't many Linux applications available using this library...

So do people all write their applications for themselves covering their own instrumentation needs?

 

Online MarkL

  • Supporter
  • ****
  • Posts: 2131
  • Country: us
Re: linux-gpib examples/utilities
« Reply #1 on: July 27, 2014, 11:57:32 pm »
I've written my own, mostly using the linux-gpib Perl library.  I've also written a perl wrapper for my instruments so I can do queries from the shell:

Code: [Select]
  $ pspq *idn?
  HEWLETT-PACKARD,E3631A,0,2.1-5.0-1.0

  $ dmmq    # read value from 3478A
  +0.47033E+0

Or, set things:

Code: [Select]
  $ psp "APPL P6V, 3.3, 0.1"   # set 6V output to 3.3V@100mA
  $ psp "OUTPUT ON"

With this simple interface, most everything I need gets written in bash.  Occasionally, I've written some projects directly in Perl or C if I needed faster acquisition or control.

After getting the data, I usually use gnuplot for simple plotting, or octave for any signal analysis.

I've been pretty happy with the "roll your own" approach.  There's certainly no support for linux-gpib, or Linux in general, from any equipment manufacturer that I'm aware of.
 

Offline davorinTopic starter

  • Supporter
  • ****
  • Posts: 922
  • Country: ch
Re: linux-gpib examples/utilities
« Reply #2 on: July 28, 2014, 10:12:06 pm »
Started now with Python....and after some heavy reading and googeling around I came to this first program...

It send the screendump command to my LeCory 9414 and reads the HPGL output and pipes it through hp2xx to convert the HPGL format to a PNG file:

Code: [Select]
#!/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 -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,15)

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()


Especially the piping to another program was a nightmare to find out how it should be done correctly (o;

Sample output:

« Last Edit: July 28, 2014, 10:56:47 pm by davorin »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf