Skip to content

Commit

Permalink
ENH: new VISA transport layer to talk to almost all lab devices with
Browse files Browse the repository at this point in the history
different interfaces
  • Loading branch information
DavidLP committed Mar 13, 2015
1 parent b542d44 commit 9245d18
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions host/basil/TL/SiVisa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
import visa

from basil.TL.TransferLayer import TransferLayer


class SiVisa(TransferLayer):

'''Transfer layer for a Virtual Instrument Software Architecture (VISA) provided by pyVisa.
Several interfaces are available (GPIB, RS232, USB, Ethernet). To be able to use pyVisa without
the proprietary NI-VISA driver a pyVisa backend pyVisa-py is used.
GPIB under linux is not supported via pyVisa-py right now and linux-gpib does not
compile on modern kernels right now. Thus no GPIB linux support on modern systems.
'''

def __init__(self, conf):
super(TransferLayer, self).__init__(conf)
self._port = None

def init(self):
'''
Initialize the device.
Parameters of visa.ResourceManager('@py').open_resource()
'''
rm = visa.ResourceManager('@py')
self._resource = rm.open_resource(**self._init)

def write(self, data):
self._resource.write(data)

def read(self):
self._resource.read()

def ask(self, data):
return self._resource.query(data)

1 comment on commit 9245d18

@themperek
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It somehow breaks the API: http://basil.readthedocs.org/en/latest/software.html#transfer-layer-tl
But maybe this is ok in this case?
Have to think about this. Use case?

Please sign in to comment.