
Description
This is a python wrapper written in C, it interfaces Python methods to
some GPIB library routine(s), and pass results back to Python. It is more
or less from the linux-gpib project, which is similar to National Instruments
API. I changed some include files and commented out some option values that
seem to be missing in Ni488 driver. This allows Python programs to control
GPIB controlled test instruments from Windows, and I hope the same Python code
can work from Linux.
Source
Index of Source.
Installer
In reading the License:
3 Restrictions. You may not: ... distribute in whole or
part, ... Nothing in this Agreement, however, is intended to
prevent you from creating your own driver interface software
for use with NI software and third party hardware; provided,
however, that in doing so you do not modify or use (in whole or
part) any of the driver interface SOFTWARE.
Some parts are eliminated (...) that do not seem involved. It clearly is
saying that I can't provide ni488.h or gpib-32.obj to build an installer,
but I guess I can distribute the interface software (Python wrapper) I made
with them.
If you buy a NI GPIB card then you have a license and can build your
own installer, or use the one I'm using and providing. Keep in mind that both
Python and Ni488 must be installed before running the Python wrapper installer
I'm providing. This software is provided AS IS, and it is to be USED AT YOUR
OWN RISK. With that said I have had good results so far.
The 2.6 version has changed, based on updates at the linux-gpib project, thus
breaking backward compatibility and adding useful new features.
Index of Distribution.
Usage
To build your own installer follow instructions in Setup.py
Example
from time import sleep
from Gpib import *
# Set the device names 'dvm', 'dasu' with correct address using
# C:\Program Files\National Instruments\NI-488.2\Bin\GpibConf.exe
dvm = Gpib('dvm') # old hp3478A
dasu = Gpib('dasu') # Agilent 34970A with 34901A
dvm.clear()
dasu.clear()
dvm.write('D0 Q0') # some old commands :-/
for i in range(0,10):
sleep(1)
print dvm.read()
dasu.write(':MEAS:TEMP? TC,J,(@120)') # SCPI commands :-)
print "Temperature: " + dasu.read()
dasu.write(':MEAS:VOLT:DC? (@111)')
print "Vin: " + dasu.read()
dasu.write(':MEAS:VOLT:DC? (@101)')
print "Vout: " + dasu.read()
Notes
A look at Gpib.py should tell you all you need to do
programing, and if its simple coverage is enough for your task.
I will not add to this unless it originates form linux-gpib or an
Open Source equivalent. This is provided to ease migration as such
it must remain compatible, it is not to provide Windows only
service.
Since this Wrapper is from the linux-gpib Python interface, you
don't need to change code to run the same program on Windows or
Linux. On the down side linux-gpib does not have some complex but
powerful features for instance a way to handle a service request with
a callback.
Have a look at PyVISA this may be a better fit, but I have had
good results with and am still using this wrapper.
CHANGE LOG: History
$Id: index.html,v 1.8 2009-01-23 05:41:38 rsutherland Exp $ Rev B
B) Return installers and update Python wrapper
A) Remove installers and change to very textual html format
Release New: Initial release
Copyright Notice
Copyright (C) 2004-2008 Ronald Steven Sutherland
To report errors or omissions http://rsutherland.epccs.org
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled "GNU Free
Documentation License".
GFDL taken form http://www.gnu.org/copyleft/fdl.html