Showing results for 
Search instead for 
Did you mean: 

VISA Driver on unknown connection type

Go to solution

I can't be the only person with this problem in LabVIEW and I still haven't worked out the solution.

Say for example I write a driver for a PSU, this device is off the shelf but the manufacturer supplied driver is ***!

Instrument is connected by GPIB. in this instance.


3 months later I want to re-use the driver but due to cost implcations I can't have the GPIB flavour of the instrument and have to have the RS232 version, so I re-write the driver so that all R/W functions are wrapped by a VI that uses the correct process for reading serial ports if it is an RS232 device and re-do the initialisation process too.


3 months later still I get hold of a USB version of the PSU - this will use the GPIB style code and doesn't take long to modify.


The question is this:


Is there anyway that anyone knows of (ignoring VISA aliases) that will allow me to determine the physical connection to the PSU from the PC if someone changes it and therefore use the correct part of the driver code to initialise and communicate with the PSU.

Specifiying the Intf Type is a SW fix for a HW problem that causes more issues if the connection is changed over, how can I allow someone to use RS232/USB/GPIB and detect the connection type myslef within LabVIEW before I do a *IDN and onpen the port?


Thanks in advance for any ideas



CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 1 of 4
Accepted by topic author James_W
Have you looked at any of the NI drivers? The shipping example of the Agilent 34401 is sufficient. In the Initialize function, there is a test to see if the VISA resource is a serial port. The case statement for the true condition configures the port. There are no other changes as a GPIB, USB, or Ethernet connection will work exactly the same way.
Message 2 of 4

Hi Dennis,


OK, I thought, that's what I've been doing maybe I'm wrong as it doesn't seem to always work. I haven't found enough info on the Intf Type command to be sure that it will update from standard dependent on HW connection. Although I'm sure if you say it does then it does. (There are a few people on the forum whose word I am prepared to take as gospel when it comes to LabVIEW issues).



CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 3 of 4
As long as the classes are correct - USBTMC and VXI11, I've never had any real issues though there may have been some bugs in various NI-VISA versions.
0 Kudos
Message 4 of 4