haata / ugsimple-usb-gpib

Python libusb UGSimple GPIB Driver
GNU General Public License v3.0
13 stars 4 forks source link

ugsimple-usb-gpib

Python3 libusb UGSimple GPIB Driver

Tested using Linux, should work for Mac OSX, Windows and any OS with Python libusb support.

Setup

Linux

It is recommended to add the udev rule so root isn't required.

sudo cp 98-ugsimple.rules /etc/udev/rules.d/.
sudo udevadm control --reload-rules

Usage

Initialize UGSimpleGPIB

from ugsimple.GPIB import UGSimpleGPIB
mygpib = UGSimpleGPIB()

Writing "my command" a command to address 0x02

mygpib.write( 0x02, "my command" )

Reading from address 0x02

data = mygpib.read( 0x02 )
print ( data )

Writting and reading the returned result using the ask() method

device_id = mygpib.ask( 0x02, 'ID?' )
print ( device_id )

See ugsimple/GPIB.py for further documentation.

Notes

Currently not well tested. The USB command set for the UGSimple GPIB adapter should be complete but hasn't been tested with many devices yet.

Comments/Bug Reports/Patches welcome :D