12-07-2022 04:50 AM
Hi, everyone
is it possible to change the current COM port in LabVIEW.
e.g. from COM8 to COM10
Normally you would do something like this manually in Device Manager.
Solved! Go to Solution.
12-07-2022 09:41 AM - edited 12-07-2022 09:49 AM
Well... Com ports are usually selected using a VISA Resource Name control on the front panel or a VISA constant on the block diagram.
The drop down (click on the arrow) will populate with all the VISA resources that NI-Max can find.
Remember: For LabVIEW to "see" it NI-Max has to see it first.
NI-Max should find all the Com ports that Windows Control Panel finds.
I will also add that you can find these programmatically using the Find VISA Resources in your program.
Using this you can find what ports are there and if you add some code you can then check every Com port (ASRL:) that shows up for your instrument.
12-07-2022 10:34 AM
Do you mean to change the COM port assignment in the software (meaning, the software will stop looking for the device on COM8 and start looking on COM10) or do you mean to change the hardware COM assignment (meaning COM8 becomes COM10)?
If the latter, it's kind of a rabbit hole. I would start by figuring out how to do it in command prompt or powershell and then automating it with LabVIEW.
https://superuser.com/questions/851192/change-com-port-number-programmatically
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YGivCAG&l=en-US
https://www.ni.com/docs/en-US/bundle/ni-package-builder/page/call-powershell-commands.html
12-08-2022 12:10 AM
Finding and using the available COM ports is not the problem.
The problem is that the detected COM port should become COM10, for example COM8.
12-08-2022 01:41 AM
If this is a USB RS-232 adapter, you might get a new COM port every time you plug it in. I don't know if you can even control how that works, as I think this is a Windows issue and not a LabVIEW one.
12-08-2022 08:55 AM - edited 12-08-2022 09:02 AM
@Laura.Sturm wrote:
Finding and using the available COM ports is not the problem. The problem is that the detected COM port should become COM10, for example COM8.
Well what Com port Windows assigns to a USB device is a "Windows" thing not LabVIEW. There is no way to directly change that using LabVIEW.
Windows will assign every new device a different Com port but it should give one specific device the same com port every time because Windows remember the UUID if every device plugged in. You can go into Windows Device Manager and clear out all the com ports listed as "in use" manually.
Use "Find VISA Resources" to find all the active com ports and add some code to determine which one your device is on instead of trying to make every device you plug in be the same com port.
12-09-2022 12:12 AM
I found a way to solve the problem
https://www.ftdichip.com/Support/Knowledgebase/index.html?ignorehardwareserialnumber.htm
12-09-2022 08:57 AM
@Laura.Sturm wrote:
I found a way to solve the problem
https://www.ftdichip.com/Support/Knowledgebase/index.html?ignorehardwareserialnumber.htm
That can solve it on one computer but if you ever plan on deploying this as an actual application you will have to do that on every computer it is deployed on.
12-09-2022 09:21 AM
@RTSLVU wrote:
@Laura.Sturm wrote:
I found a way to solve the problem
https://www.ftdichip.com/Support/Knowledgebase/index.html?ignorehardwareserialnumber.htm
That can solve it on one computer but if you ever plan on deploying this as an actual application you will have to do that on every computer it is deployed on.
Good thing you can modify the registry values with the LV installer packages.
12-09-2022 09:57 AM
@Frozen wrote:
@RTSLVU wrote:
@Laura.Sturm wrote:
I found a way to solve the problem
https://www.ftdichip.com/Support/Knowledgebase/index.html?ignorehardwareserialnumber.htm
That can solve it on one computer but if you ever plan on deploying this as an actual application you will have to do that on every computer it is deployed on.
Good thing you can modify the registry values with the LV installer packages.
Sure, but that can lead to the installer needing Administrator privileges and that can turn into big shat storm when dealing with IT security.