Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic VISA resource name COM port assignment

Solved!
Go to solution

Hi,

I connect two external USB devices (one IR sensor and one GPS) which I sample with Visa Read. Is there any clever way to assign the devices the correct COM port number programatically? I figured I could use the error output to reassign the recource name in a loop, but that isn't a particularly elegant method. Is there a better option out there?

 

Can I maybe ping each COM port some how and get some clue on which of the devices that is connected to it?

 

Thank you,

Josefin

0 Kudos
Message 1 of 3
(2,470 Views)
Solution
Accepted by crossrulz

@JosefinS wrote:

Can I maybe ping each COM port some how and get some clue on which of the devices that is connected to it?


You can use the Find VISA Resources to get a list of the available COM ports.  Then you have to loop through each port and attempt some type of communication to figure out who, if anybody, is attached to that port.  I am not aware of a better option.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(2,461 Views)

Thank you for your suggested solution. I have now successfully, through the Find VISA Resources VI, identified the two different devces and extracted the COM port number associted with each device. Thankfully, it was possible to wire a string input as VISA Recource name to the Visa Open sub-vi and from that get the VISA Recource name data type that was needed for the rest of the code.Thanks again! /J

Message 3 of 3
(2,431 Views)