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: 

Scan and Read USB port

Hi!
I have USB port in my test jig. So first i want to scan my usb port and it also reads com port number.
what happened, if i connected my test jig with one PC than USB port (COM 4) and some other PC it gives (COM3) through device manager. so every time i have to look device manager and look which port is connected with USB and i have to change port number in program.
so i want to scan usb port and read which com port is connected to USB
 
thanks
0 Kudos
Message 1 of 5
(4,516 Views)
Hi swami,
I think there is no way to distinguish between native COM-ports and virtual serial RS232-devices via USB. If you use the VISA VIs to control your serial interfaces, use "VISA Find Ressource" to list the available serial interfaces. As an example you can use it as follows:


Greets, Dave

Message Edited by daveTW on 01-24-2007 09:44 PM

Greets, Dave
0 Kudos
Message 2 of 5
(4,516 Views)
hi!
thanks for your reply. I have made that VI which find resources from computer using VISa find resource. but how to differentiate that COM3 or COM4 is USB port? and write in my program. 
0 Kudos
Message 3 of 5
(4,502 Views)
Hi swami,
when you unplug the USB- device, do you still have a COM- port in the system manager?
As I stated above, I think, there is no way to detect whether a COM is a USB- COM port or a Computer-built-in serial device. And what do you mean by "and write in my program."
Greets, dave
Greets, Dave
0 Kudos
Message 4 of 5
(4,497 Views)

How does it matter whether it is a USB converter or not? If you have a serial connection to some instrument, with the array of com ports you could send a command out each one. When you get the correct response, you know you've found the active port and use that.

If you really want to determine which com ports are usb-232, that information is stored in the windows registry. It's pretty deep (i.e. HKEY_LOCAL_MACHINE\System\ControlSet001\Enum\USB is where is listed 'serial device' but on my machine, another tree lists the 'Comx' name so traversing the registry would not be exactly trivial.

0 Kudos
Message 5 of 5
(4,483 Views)