LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically determine and select VISA COM Port Binding

Solved!
Go to solution

@t.n14 wrote:

We have a testing PC with the same problem, we use ComPortMan, completly worth it.

You can define fixed ports for specific devices and ports for constantly switching devices to be a specific port.

 

Timo


Holy cow, I think this could solve some issues that I have as well.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 21 of 31
(1,481 Views)

I found this article that I thought could work, but unfortunately clearing the resources didn't change anything...

0 Kudos
Message 22 of 31
(1,450 Views)

@nikvl wrote:

I found this article that I thought could work, but unfortunately clearing the resources didn't change anything...


That article is specifically for NI Serial devices (ie serial devices sold be NI).  It will not apply to your device in question.  Though, you may be able to use something like CCleaner to clear out the registry of unused ports (I have not specifically looks to see if this is done).


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 Kudos
Message 23 of 31
(1,446 Views)

@crossrulz wrote:

@nikvl wrote:

I found this article that I thought could work, but unfortunately clearing the resources didn't change anything...


That article is specifically for NI Serial devices (ie serial devices sold be NI).  It will not apply to your device in question.  Though, you may be able to use something like CCleaner to clear out the registry of unused ports (I have not specifically looks to see if this is done).


That's unfortunate. Many of the suggestions require having to change the settings manually on the deployment PC, which is something I'd like to avoid. Honestly I didn't think it would be this complicated and imagined it possible because in another program we communicate with a Bronkhorst instrument to get a digital readout, and using their .exe requires you to set the COM port number first and it would only always initialize using that number and when it detects a different device from a previous time, a message pops up and asks if you want to override, but otherwise the COM port number stays the same.

0 Kudos
Message 24 of 31
(1,437 Views)

@t.n14 wrote:

We have a testing PC with the same problem, we use ComPortMan, completly worth it.

You can define fixed ports for specific devices and ports for constantly switching devices to be a specific port.

 

Timo


Do you have set it once and then Windows remember the settings, or do you have to periodically check and and re-run the software? I assume one needs administrator rights to run it, and if it's just a single time during deployment that might be fine, but otherwise it might complicate maintenence.

0 Kudos
Message 25 of 31
(1,400 Views)
Solution
Accepted by topic author nikvl
I have found a solution which works for my needs. It involves running a .reg file to automatically insert the necessary keys in the registry to ignore the serial number of the USB Serial Port. So this would only affect the COM of my DUT (since they all have the identical Hardware-ID) but not other devices. This means it will always have the same COM-Port number provided I insert into the same physical port every time.
Message 26 of 31
(1,375 Views)

Good job!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 27 of 31
(1,370 Views)

Hello,

 

Can you please explain your solution in detail and if possible share LabVIEW code or any script involved.

 

I'm also facing similar situation to yours and want to avoid different COM Port number assignments for devices of same types.

 

Thanks.

0 Kudos
Message 28 of 31
(1,341 Views)
First of all, a DISCLAIMER: This involves writing into your registry keys and requires administrator rights. If you choose to use this method and mess up, I and/or my employer will NOT be held responsible, so proceed at your own risk. Step 1: Go to your device manager and find the hardware-ID of your USB. If you get something like FTDIBUS\COMPORT&VID_0102&PID_5013, take note of the number eg. 01025013. That's your USB serial number Step 2: Open your notepad and type this script and save the file as a .reg data type: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UsbFlags] "IgnoreHWSerNumXXXXXXXX"=hex:01 Replace the "XXXXXXXX" with the number from Hardware-ID. I honestly don't know if the Registry Editor Version number is important or not. Step 3: Double-click your saved .reg data to run it as admin. If that doesn't work, manually open regedit as admin, click on import and choose the file you saved above. Edit: I'm not sure why my reply is a wall of text and not formatted, apologies.
0 Kudos
Message 29 of 31
(1,325 Views)

@nikvl wrote:
First of all, a DISCLAIMER: This involves writing into your registry keys and requires administrator rights. If you choose to use this method and mess up, I and/or my employer will NOT be held responsible, so proceed at your own risk. Step 1: Go to your device manager and find the hardware-ID of your USB. If you get something like FTDIBUS\COMPORT&VID_0102&PID_5013, take note of the number eg. 01025013. That's your USB serial number Step 2: Open your notepad and type this script and save the file as a .reg data type: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UsbFlags] "IgnoreHWSerNumXXXXXXXX"=hex:01 Replace the "XXXXXXXX" with the number from Hardware-ID. I honestly don't know if the Registry Editor Version number is important or not. Step 3: Double-click your saved .reg data to run it as admin. If that doesn't work, manually open regedit as admin, click on import and choose the file you saved above. Edit: I'm not sure why my reply is a wall of text and not formatted, apologies.

Note that all these steps can be done from LabVIEW.

 

Depending on how often you need to do it, it might be worth a try.

0 Kudos
Message 30 of 31
(1,296 Views)