LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change COM-Port

Solved!
Go to solution
 
 
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.
0 Kudos
Message 1 of 13
(2,038 Views)

Well... Com ports are usually selected using a VISA Resource Name control on the front panel or a VISA constant on the block diagram.

 

vs2Capture.PNGvs1Capture.PNG

The drop down (click on the arrow) will populate with all the VISA resources that NI-Max can find.

 

vs3Capture.PNG

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.

vs4Capture.PNG

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.

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 13
(1,969 Views)

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

0 Kudos
Message 3 of 13
(1,949 Views)
 
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.
0 Kudos
Message 4 of 13
(1,908 Views)

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.

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 5 of 13
(1,891 Views)

@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. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 13
(1,861 Views)
Solution
Accepted by topic author Laura.Sturm
0 Kudos
Message 7 of 13
(1,835 Views)

@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. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 8 of 13
(1,769 Views)

@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.

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 9 of 13
(1,757 Views)

@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. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 10 of 13
(1,749 Views)