Home / OpenGPIB
Name Modified Size InfoDownloads / Week
Parent folder
ChangeLog 2015-11-16 2.6 kB
README 2015-11-16 6.6 kB
openGPIB-0.13.tar.gz 2015-11-16 347.2 kB
Totals: 3 Items   356.5 kB 0
This is the OpenGPIB library, written from scratch by rickyrockrat
(gpib at rickyrockrat dot com).
What is amazing is that most of it works and actually produces useful 
data.

There are other efforts out there but none that really supported Linux. 

Notable sites such as http://www.ke5fx.com (Windows only) and 
http://www.ko4bb.com/ (RF site) should be referenced.

There was some attempt to write a wrapper for the graphics library
for the GPIB Toolkit the ke5fx offers, however it would have taken
a lot of testing using a Windows box, and I have very little patience
with Windows these days.  Besides, I had to get some work done (i.e.
data out of my test equipment).

The web page is http://opengpib.sourceforge.net. Other useful links are:
http://la2vcd2.sourceforge.net (another tool I'm developing, a fork of la2vcd).
http://gtkwave.sourceforge.net

All the tools should accept -h for a usage page.

Here are some useful invocations of the tools:

Network Analyzer
/networkanalyzer -a s9 -a a18 -d s/dev/ttyUSB0 -d a/dev/ttyUSB1 -f s1 -f e2000 -i 1000 -m c -l s10  -f f -c cablecal10.cal
Signal generator on /dev/ttyUSB0, address 9, Analyzer on /dev/ttyUSB1, address 18
Start frequency 1Mhz, end frequency 2000Mhz, increment of 1000kHz, mode is calibration, level is 10dbm

The -f f sets a follow mode (see usage).

Extract a 1655x waveform:

Get the trace.
./get_hp_16555_waveform -d /dev/ttyUSB2 -t foo.dat
Get the configuration:
./get_hp_16555_waveform -d /dev/ttyUSB2 -c foo.cfg

Parse the trace file into a format la2vcd can use:
./parse_16500_config -d foo.dat  -f foo.la

Convert the trace to a vcd:
la2vcd -td 2ns -r 16 -b 32 -sf 31 CLK -sf 29-24 RED -sf 11 STVD -sf 10 STVU -sf 9 CLKV -sf 7 OE -sf 5 LD -sf 3 POL -sf 1 DIO2 -sf 0 DIO1 foo.la -o foo.vcd 

Extract a Tek 2440 waveform (extracts to base.ch1 base.ch2 base.cursors):
./get_tek_waveform -a 9 -c ch1 -c ch2 -c cursors -d /dev/ttyUSB1 -o base

Extract a Tek TDS waveform:
./get_tek_waveform -d /dev/ttyUSB0 -c ch1 -c ch2 -c ch3 -o MyMeasure

Generate a GNU plot for X11 for TDS:
./tek2gplot -p TDS -m -o MyMeasureP -t wxt -i MyMeasure.ch1 -i MyMeasure.ch2 -i MyMeasure.ch3

Perform zoom on the plot for X11:
./tek2gplot -p TDS -m -o MyMeasureP -t wxt -i MyMeasure.ch1 -i MyMeasure.ch2 -i MyMeasure.ch3 -z x1119 -z x1430 -z y3 -z y3

Zoom takes the form -z axis

Manipulate and display the tek data:

tek2gplot
This will add additional plots using a function. Available functions as of 0.1 are:

diff
max-y
min-y
pk-pk

see makepng for an invocation that will generate a png. Leave terminal type off for
and Xwindow.

This has only been tested on a 64-bit Linux operating system (though it should work on 32 just fine), 
and only 2 controllers are supported thus far.  It's prettty easy to write new controller interfaces.

Look at hp16500ip.c/h or prologixs.c/h (device implemntation) and gpib.c/h.

You add the open, read, write, close, and control function implementation, then the define
for the new controller, and it should "just work". 

Here are the steps to adding another controller:

1) The functions in the dev implementation need to be duplicated (hp16500ip.c/h or prologixs.c/h).
2) The interface type needs to be added to the enum in gpib.h (GPIB_CTL_*).
3) Add the entry in the table at the top of gpib.c (supported_dev).
4) Add the entry to the case in open_gpib.

It is CRITICAL that you check for NULL in the control functions, and allocate the internal struct
if null, because the system runs control before open to set debug.

This project is layered. The bottom layer is the interface, serial/ip/usb (latter not implemented)
The next layer is the controller, currently prologix and hp16500C.
Lastly is the top layer instruments. The structure layout is:
The control is lower than the device. The control should only be visible to the interface file (serial.c/ip.c)
The device contains the interface structure, and the highest is the gpib struct. So:
gpib->dev->ctl

See get_hp_16555_waveform.c to see how the option works from the table in supported_dev.
There are 2 functions that work on this table, one displays supported controllers, the 
other validates the option and returns the device type.

Have now added get_hp_1653xx_scope, which talks to hp16530,16532,and 16534 scope cards.
The setup with 2 '32 cards in master-slave and 2 '34 cards in master-slave works, and 
I am able to match the data between the '32 and the '34 cards, which gives me an
8-channel o-scope.  I am using an external trigger from a tek positive-hi TTL signal

using a simple TTL-ECL converter like so:
                       GND
                        |
                        C
                        |
IN---+---||----R100-+-B-PNP
     |  C104        |   | 
     R50           R1K--+---OUT  
     |                 
     GND

Where R50=50 ohm, R100=100ohm and R1K is 1k ohm
PNP is MMBT4401, and C104 is .1uF cap.
BFQ19/BFS17A/BFR93A can also be used. Delay is around 60-70nS
OUT is tied to the inputs of both master cards.  These connectors are SMB microwave
connectors, and I managed to find some SMB jumpers on ebay for $5 USD.
 

REALLY useful scripts:

********** setup_16532 ***************

ex - save setup - automatically appends -cardtype.set to the file name.
setup_16532 -s 13 -s 14  -g my_settings_file
-restore setup
setup_16532 -s 13 -s 14  -p my_settings_file
- load a config file on the HP16500, then setup the settings (in this case,
the channel skew file - saved earlier):
setup_16532 -l 14PSKEW -s 13 -s 14  -p my_settings_file

************* get_hp_plot *************
- grab the data from both the 14 and 13 card types, put the data in base filenames
'mybase', set the gnuplot output type to x11, both grab the data and plot it, and 
- add the title 'mytitle' to the plot:

get_hp_plot -t 14 -t 13  -b "mybase" -k x11 -m all -p "-t mytitle"

This generates (with 2 '32 cards and 2 '34 cards) mybase-13.ch1,ch2,ch3,ch4,
mybase-14.ch1,ch2,ch3,ch4, and mybase.plot. If you set the type to -k png, it 
will also generated mybase.png. 

If you change -m all to -m plot, it will only plot the files, not grab them
from the HP16500 again. This is useful in conjunction with -k x11 to validate 
the plot before dumping it to png.

the -p "-z optz -y opty" sends the commands to plot-file, which is the one actually
doing the plotting. if you specify, for example -p "-x 5:7 -t mytitle", you will 
put 'mytitle' at the top of the graph, and limit the x range to between 5 and 7,
useful for zooming in and out on the plot.



Feel free to e mail me at g p i b a t rickyrockrat d o t  n e t.


Source: README, updated 2015-11-16