From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Resource Name Strings

Solved!
Go to solution

Hi There,

 

Say I have a "VISA Resource Name" control on my front panel, as per the attached screenshot, that should automatically populate with the names of all the VISA resources that the PC can see.

 

Is there a way of programmatically getting an array of these names as strings (via a property node, or whatever)?

 

Many Thanks,

Dan

Dan
CLD
0 Kudos
Message 1 of 8
(7,329 Views)

Try this:

ReadOnce_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 2 of 8
(7,314 Views)
Solution
Accepted by topic author DanB1983

From the block diagram go to Instrument I/O > VISA > VISA Advanced > VISA Find Resource. This VI will return an array of strings. You can type cast the string into a VISA Resource type.

Message 3 of 8
(7,303 Views)

It should do this automatically but my experience is that the populating of the control is often quite buggy.  It also depends on whether you have ports open or not.

 

The suggestion given already with "Find VISA resource" is probably the best.  It's what I normally use.

 

Shane

Message 4 of 8
(7,287 Views)

If I wanted to return the alias (where present), rather than the raw ID of the VISA resource, is there a way of doing that?

 

Or would it be a case of getting my software to manually parse the visaconf.ini file?

Dan
CLD
0 Kudos
Message 5 of 8
(7,281 Views)

Parsing the visaconf.ini would probably the best way to get the alias, at least as far as I know. I'm not sure if there's a way to programmatically get the alias. I've search for quite some time to find a way to do this programmatically but haven't found any real robust solutions. On occasion I've used a property node on the VISA resource to get the Interface Description (LV help states it is not recommended to make decisions based on the description because it could change in the future) and parsed out the "COM#" aliases, but I don't think this a robust or recommended way of doing it.

Message 6 of 8
(7,276 Views)

It's possible to get aliases by using the proper "search mode" as input for the VISA Find Resource function. Please check the function help.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 7 of 8
(7,261 Views)

I must have read over that part in the help, that's extremely useful, no parsing, no file reading. Thanks.

0 Kudos
Message 8 of 8
(7,256 Views)