pyvisa / pyvisa-py

A pure python PyVISA backend
https://pyvisa-py.readthedocs.io
MIT License
282 stars 120 forks source link

secondary_address ignored #307

Closed LWirmO closed 1 year ago

LWirmO commented 3 years ago

Current code ignores the user defined "secondary_address" and is hard coded to "0" in "gpib.py" line 258 "sad = 0"

Simple fix can be done by adding a line "sad = int(self.parsed.secondary_address) + 0x60" below line 264 "pad = int(self.parsed.primary_address)".

"0x60" above is the secondary_address offset used by linux-gpib backend. Not sure what value it would be if Keysight or other backend is used: https://linux-gpib.sourceforge.io/doc_html/reference-function-ibsad.html

MatthieuDartiailh commented 3 years ago

Secondary addresses where not used at first as a simplification, however I would be fine with a PR adding support for it, but I have no hardware on which to test the changes.

Also note that currently both PyVISA and pyvisa-py treat a secondary address of 0 as no secondary address which is not correct so if you make a PR to pyvisa-py it may be worth trying to also address this. I will do it if I can find some time but that is unlikely to happen soon, so feel free to have a look.