ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

Instrument Control (GPIB, Serial, VISA, IVI)

キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Automatic VISA resource name COM port assignment

解決済み
解決策を見る

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 件の賞賛
メッセージ1/3
2,415件の閲覧回数
解決策
受理者 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.


GCentral
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 件の賞賛
メッセージ2/3
2,406件の閲覧回数

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

メッセージ3/3
2,376件の閲覧回数