ni.com is currently experiencing unexpected issues.
Some services may be unavailable at this time.
05-14-2020 04:31 AM
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
解決済! 解決策の投稿を見る。
05-14-2020 04:49 AM
@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.
05-14-2020 09:28 AM
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