LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to programatically pick a USB port

I'm using a device that plugs into the USB port and you can use the VISA commands (open, write, read, etc) to talk to it.  The VISA VIs need a device name and the device comes up like ASRL:X (where X is usually something like 5,6,7 etc).  I'd like to make a VI that will search through available devices to "find" the USB device.  Now I know I could  use a string ASRL:X and go through the numbers but I'd be going though things that aren't even there.  Is there a VI, command or something that will list available devices?
 
Thanks
Chuck
0 Kudos
Message 1 of 3
(2,849 Views)
On the VISA Advanced palette (7.x), there is the function VISA Find Resource. As the on-line help mentions, you can specify something like ASRL[0-9]*::?*INSTR as the expression and it will return an array of resources. ASRL10 is typically the printer port so you may want to modify the expression.
0 Kudos
Message 2 of 3
(2,843 Views)


@Dennis Knutson wrote:
On the VISA Advanced palette (7.x), there is the function VISA Find Resource. As the on-line help mentions, you can specify something like ASRL[0-9]*::?*INSTR as the expression and it will return an array of resources. ASRL10 is typically the printer port so you may want to modify the expression.


Thanks.  I had already written what I had thought of before which works fine but leaves you testing things that may not even exist.  Adding your suggestion will just make it that much better.
 
Thanks
Chuck
0 Kudos
Message 3 of 3
(2,832 Views)