-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADD_GPIB #88
Open
Marrkson
wants to merge
1
commit into
SiLab-Bonn:master
Choose a base branch
from
Marrkson:development
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
ADD_GPIB #88
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Device description for HP E3632A Powersupply. | ||
# set_ function expect a parameter, get_ function return a parameter. | ||
# Just the very basic commands are imlemented here. | ||
identifier : HEWLETT-PACKARD,E3632A,0,1.1-5.0-1.0 | ||
on : OUTP ON | ||
off : OUTP OFF | ||
disp_on : DISP 1 | ||
disp_off : DISP 0 | ||
get_current : MEAS:CURR? | ||
set_current : SOUR:CURR | ||
set_voltage : SOUR:VOLT | ||
get_voltage : MEAS:VOLT? | ||
set_current_limit : CURR:PROT | ||
get_current_limit : CURR:PROT? | ||
set_voltage_limit : VOLT:PROT | ||
get_voltage_limit : VOLT:PROT? | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I see it the only difference to the already existing VISA implementation is the query command. So one could simplify this module to: class PrologixVisa(Visa):
def query(self, data):
self._resource.write("++auto 0")
self._resource.write(data)
return self._resource.query("++read eoi") and it would do the same, no? |
||
# ------------------------------------------------------------ | ||
# Copyright (c) All rights reserved | ||
# SiLab, Institute of Physics, University of Bonn | ||
# ------------------------------------------------------------ | ||
# | ||
import visa | ||
import logging | ||
|
||
from basil.TL.TransferLayer import TransferLayer | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class PrologixVisa(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 can be used. | ||
GPIB under linux is not supported via pyVisa-py right now. | ||
''' | ||
|
||
def __init__(self, conf): | ||
super(PrologixVisa, self).__init__(conf) | ||
self._resource = None | ||
|
||
def init(self): | ||
''' | ||
Initialize the device. | ||
Parameters of visa.ResourceManager().open_resource() | ||
''' | ||
super(PrologixVisa, self).init() | ||
backend = self._init.get('backend', '') # Empty string means std. backend (NI VISA) | ||
rm = visa.ResourceManager(backend) | ||
try: | ||
logger.info('BASIL VISA TL with %s backend found the following devices: %s', backend, ", ".join(rm.list_resources())) | ||
except NotImplementedError: # some backends do not always implement the list_resources function | ||
logger.info('BASIL VISA TL with %s backend', backend) | ||
self._resource = rm.open_resource(**{key: value for key, value in self._init.items() if key not in ("backend",)}) | ||
|
||
def close(self): | ||
super(PrologixVisa, self).close() | ||
self._resource.close() | ||
|
||
def write(self, data): | ||
self._resource.write(data) | ||
|
||
def read(self): | ||
self._resource.read() | ||
|
||
def query(self, data): | ||
self._resource.write("++auto 0") | ||
self._resource.write(data) | ||
return self._resource.query("++read eoi") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
transfer_layer: | ||
- name : PrologixVisa | ||
type : PrologixVisa | ||
init : | ||
resource_name : ASRL::INSTR | ||
read_termination : "\n" | ||
backend : "@py" | ||
|
||
hw_drivers: | ||
- name : Powersupply | ||
type : scpi | ||
interface : PrologixVisa | ||
init : | ||
device : hp e3632a |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The identifier does not have to be fully matched. So sometimes it is better to not specify minor firmware versions for compatibility. I guess HEWLETT-PACKARD,E3632A could be enough here?