Simple wrapper for the Prologix GPIB-to-Ethernet adapter.
Go to file
Nelson Darkwah Oppong f298d8f2ee Merge pull request #1 from nelsond/fix-socket-issue-python-3
Fix socket issue python 3
2016-08-30 19:30:46 +02:00
examples initial commit 2016-08-19 16:08:37 +02:00
plx_gpib_ethernet Fix socket issue on Python 3 2016-08-30 19:24:11 +02:00
requirements initial commit 2016-08-19 16:08:37 +02:00
tests Fix MockSocket 2016-08-30 19:23:11 +02:00
.gitignore Add pytest-local.py to .gitignore 2016-08-30 19:17:37 +02:00
.travis.yml Add pip install to .travis.yml 2016-08-19 16:52:41 +02:00
CHANGELOG Version bump 2016-08-20 11:41:18 +02:00
README.md Fix typo in README.md 2016-08-20 11:40:37 +02:00
requirements.txt initial commit 2016-08-19 16:08:37 +02:00
setup.py Fixed setup.py 2016-08-19 16:51:15 +02:00

Prologix GPIB-to-Ethernet Python wrapper Build Status

Simple wrapper for the Prologix GPIB-to-Ethernet adapter. Also includes a simple device wrapper class.

Currently only supports the CONTROLLER mode of the Prologix GPIB-to-Ethernet adapter.

Requirements

Make sure you can reach/ping the adapter before you start using this library.

Install

Install with pip

pip install git+git://github.com/nelsond/prologix-gpib-ethernet.git

Example usage

Using the adapter directly

from plx_gpib_ethernet import PrologixGPIBEthernet

gpib = PrologixGPIBEthernet('192.168.1.14')

# open connection to Prologix GPIB-to-Ethernet adapter
gpib.connect()

# select gpib device at address 10
gpib.select(10)

# send a query
gpib.query('*IDN?')
# => 'Stanford_Research_Systems,SR760,s/n41456,ver139\n'

# write without reading
gpib.write('*RST')

# close connection
gpib.close()

Using the device wrapper

Also see examples/.

from plx_gpib_ethernet import PrologixGPIBEthernetDevice

class ExampleDevice(PrologixGPIBEthernetDevice):
  def start(self):
    self.write('STRT')

  def get_span(self):
    return float( self.query('SPAN?') )

my_device = ExampleDevice(host='192.168.1.14', address=10)

# open connection
my_device.connect()

# run predefined commands
my_device.idn()
# => 'Stanford_Research_Systems,SR760,s/n41456,ver139\n'
my_device.reset()

# run custom commands
my_device.start()
my_device.get_span() # => 0.191

# close connection
mydevice.close()

Development

Install requirements for development environment

$ pip install -r requirements/dev.txt

Run tests

$ py.test tests/

Generate coverage report

$ py.test --cov=plx_gpib_ethernet tests/