10-19-2023 08:37 PM
NI-488.2 is not required for the operation of NI-VISA.
It is not necessary if you do not use NI's GPIB I/F.
(If you only use LAN I/F or serial I/F, NI-488.2 is not required)
10-20-2023 12:31 PM
Thanks again for the help on this issue! Do you know how I can fix the error I am getting from pyvisa-info then? The output of pyvisa-info is in my original post
10-24-2023 03:46 AM - edited 10-24-2023 04:00 AM
There is no actual error in pyvisa-info to be seen. Yes it says that gpib_ctypes could not find the NI GPIB library. But that's normal, that library only will work with the NI hardware.
The Prologix interface is simply a serial device that implements a GPIB interface on the remote side. But in order for this to work there needs to be an intermediate driver that sits between your pymeasure module implementing the Keithley driver and the actual pyvisa library accessing the serial port. Unless pyvisa or pymeasure itself supports such a GPIB to VISA_COM translation shim specifically for Prologix, there won't be anything the pymeasure module can do with your serial port resource you open. If you pass a serial port resource to pymeasure it will attempt to send the instrument commands to it but somehow it also should control the GPIB function of the Prologix device.
One option would be if Prologix itself provides a NI-GPIB compatible DLL. In that case you could as recommended in the pyvisa-info log issue something like this before trying to importing pyvisa:
import gpib_ctypes
gpib_ctypes.gpib.gpib._load_lib(PROLOGIX_GPIB_DLL_PATH)
import pyvisa as visa
But that driver would have to be provided by Prologix.
But from the Prologix site:
Is Prologix GPIB-USB controller a drop-in replacement for controllers from other vendors?
No. Prologix GPIB-USB controller provides a virtual serial interface to communicate with instruments, while handling all GPIB protocol details for you. Programs that expect a different interface (such as NI 488.2 interface) have to be modified to use the serial interface to be compatible with Prologix GPIB-USB controller.
Basically this means that PyVISA or PyMeasure (but I would think that it is more logical to add this to PyVISA) would need to be modified to support the Prologix interface by providing the necessary translation. While a normal PyMeasure driver simply tries to send instrument commands through the provided VISA connection resource this won't work since the Prologix device needs additional commands to setup at least the mode, auto and device address, before the actual device commands can be sent to be passed to the device.
And that PyVISA modification would get quite a bit more complicated if you wanted to support multiple GPIB devices at the same time.
Basically, using a Prologix device may seem very cheap in comparison to an NI device, until you start to count in the many hours you need to make it work.
10-24-2023 12:43 PM
Thank you all for the help in this manner! Sorry for the delay in response, I had been out of office. Pymeasure does provide this translation to VISA specifically for the Prologix (and other) adapters. I will include the documentation link: https://pymeasure.readthedocs.io/en/latest/api/adapters.html#prologix-adapter
Pymeasure also provides instructions to translate for the Keithley as well: https://pymeasure.readthedocs.io/en/latest/api/instruments/keithley/keithley2400.html
These methods have worked perfectly for several months until recently. I realize NI-VISA needs a gpib driver, but I cannot find one on my computer to manually upload. When I try and repair, fix, uninstall all NI software on my laptop in attempts to run a clean install, I run into MSI errors (this is specifically what I have asked my IT about since they cannot do anything with NI, only my work laptop and its company software). Is it possible for windows to communicate via gpib without a gpib driver? I imagine it isn't. If not, how do I get one? I was attempting to get one from NI just to manually use within PyVisa, but perhaps you are saying an NI gpib driver will not work due to using a prologix cable as opposed to an NI cable so the NI driver will not recognize the prologix despite the pymeasure wrapper? Prologix has not put out any recent software/firmware updates, but perhaps I can get one from them? Open to all further suggestions and general understanding of GPIB drivers as I rarely ever mess around with dll's. Thanks again!
10-25-2023 01:23 AM - edited 10-25-2023 01:42 AM
No, pyVISA does not need a GPIB driver if you use a Prologix interface. Prologix is as far as pyVISA is concerned simply an RS-232 device.
But if pyMeasure provides some Prologix compatibility shim as you say, there must be a method or property in the pyMeasure driver to enable that and program the GPIB address of your device. I didn’t see a GPIB address to the Prologix class constructor in your example as is documented to be required in the pyMeasure documentation. Instead you try to set it later on through some other means but that looks much more complicated. Why don’t you try to do it as mentioned in the documentation?
Of course there is actually a real chance that with all your attempts to install and deinstall all kinds of NI driver software, you messed up NI-VISA itself that something doesn’t work right and that can be a hassle to untangle if the MSI database got somehow corrupted.
10-25-2023 12:47 PM
Thanks, rolfk! I normally declare the PrologixCable connection to the Keithley in this way:
import pyvisa as visa
from pymeasure.instruments.keithley import Keithley2400
import pymeasure.adapters
adapter = pymeasure.adapters.PrologixAdapter('ASRL3::INSTR') #I usually put 'COM3'
vpmeter = Keithley2400(adapter.gpib(25))
print(pymeasure.instruments.list_resources())
vpmeter.use_front_terminals() #code fails here
I will be back in my lab later today and will be sure to try declaring it exactly as the documentation listed and report back! The MSI issue and NI-VISA and NI-Package Manager has been a monster, too, so I am hoping I can get IT to take a look. I have combed just about all MSI issues on this forum and other non-NI forums and haven't found a solution. That being the case I think not having NI-VISA properly installed is a strong possibilty as is my windows system as a whole being unstable. As always open to any tips or suggestions (this has cost about a week and a half worth of test time, so it is rather dire). I plan to post back as soon as I can!
10-25-2023 05:45 PM
@ebaum wrote:
Thanks, rolfk! I normally declare the PrologixCable connection to the Keithley in this way:
import pyvisa as visa from pymeasure.instruments.keithley import Keithley2400 import pymeasure.adapters adapter = pymeasure.adapters.PrologixAdapter('ASRL3::INSTR') #I usually put 'COM3' vpmeter = Keithley2400(adapter.gpib(25)) print(pymeasure.instruments.list_resources()) vpmeter.use_front_terminals() #code fails here
I will be back in my lab later today and will be sure to try declaring it exactly as the documentation listed and report back! The MSI issue and NI-VISA and NI-Package Manager has been a monster, too, so I am hoping I can get IT to take a look. I have combed just about all MSI issues on this forum and other non-NI forums and haven't found a solution. That being the case I think not having NI-VISA properly installed is a strong possibilty as is my windows system as a whole being unstable. As always open to any tips or suggestions (this has cost about a week and a half worth of test time, so it is rather dire). I plan to post back as soon as I can!
This rather proves that cutting the cost by few hundred dollars on the GPIB interface has cost you a week of engineering time to get it working.
10-25-2023 08:08 PM
Prologix has had a significant price increase of about double a few years ago, so I personally don't see the benefit of using it given the constraints of not being able to use it from VISA with the ease of NI or Keysight GPIB I/Fs.
(Previous prices were worth the trade-off between cheapness and inconvenience.)
10-27-2023 01:19 PM
Sorry for my delay in response! I am unsure about the pricing or the original use of the Prologix as it has been in my lab for some time. We never had an issue before using VISA with it and NI-VISA was always our backend. I managed to uninstall all NI software (from what I can tell because NI software tends to stick around in different ways). I then bypassed the msi issue on installation by specifically launching NI-Package Manager as admin (seemed strange to me because I have admin privileges, it just didn't open that way without launching it as admin from a terminal (or if you have the option to do it by right clicking it)). I have only re-downloaded NI-Package Manager, NI-VISA, and NI-Serial. I still do not have a gpib library (that I could find) and the output of pyvisa-info is the same as before. I also tried updated all my Dell drivers too in case it was an issue with my laptop firmware. None of these have solved the issue. Should I try an older version of NI-VISA and see if that works? Open to suggestions as always.
P.S. I also opened a question on the PyVISA forum, but have not heard back yet. Maybe the problem lies with how PyVISA is trying to use NI-VISA? I am not sure how that would have changed, but not too sure of anything at this point. I will also be trying a different laptop later today. Not a permanent solution, but if it works, may shed some light on the issue.
10-30-2023 05:10 AM
For certain operation in Windows such as installing device drivers or services, which are directly affecting the Windows kernel, you require a special elevated privilege level. Being logged in as admin is not enough. The process needs to be started explicitly as admin. If this is done while being logged in as admin, you only get a confirmation dialog that asks you to acknowledge that a process gets started that could potentially completely ransom your entire Windows system. If logged in as another user, you get a login dialog asking you for the admin credentials. This elevated process is then able to do pretty much anything it wants to Windows, so you want to be sure you know what process it really is before acknowledging either dialog.
Windows has some heuristics that try to determine if a process might need these elevated rights. For instance programs called setup.exe are considered installers that need these privileges and Windows will prompt you for confirmation to elevate the program on start automatically, without the need for you to select "Start as Administrator" from the right click popup menu in Explorer.