This widget could not be displayed.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remapping COM port number Labview 8.5

I am trying to force or  remapping one of the COM port e.g. COM9 remap to COM3 by using Labview 8.5. Anyone have any idea how to write the VI to fo it rather then using XP window. Thanks

From Johnny

0 Kudos
Message 1 of 7
(4,086 Views)

As far as I know that is a registry function, which are contained in LabVIEW, but are used with extreme peril (as is any "messing" with the registry). The functions are in the base package, and there are some examples. I did something like this a year ago, it is on another machine which isn't available at this moment. I try and look at it this evening when I'm in my hotel (I'm out of town this week). I don't think that I remapped the port assignments, don't remember, did have to change port settings normally accessable only in Device Manager, so I think it is applicable.

 

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 7
(4,063 Views)

Thank you Putnam Monroe and I am really appreciated for your advice/help.

 

I am writting the vi production test and require to test many device with USB built in. I prefer to automate to remapping/force the COM port to allocate assign to the same  COM port number by using labview, rather then using the Device Manager in XP window. 

 

Problem: COM port number keep on changing every time I test plug in the same PC USB port with diffrent device/product. I know there is a way to configure the registry in the PC but I prefer to use Labview automate to force the COM port change/assign to COM port number as I have mention in my 1st forum.  Thank you.

 

 

0 Kudos
Message 3 of 7
(4,047 Views)
What I am suggesting is that you use LabVIEW to make the registry changes, I don't think that there is any other way for LabVIEW to remap the ports. There might be a way for you to have LabVIEW "discover" the new port number and perform your tests on the port that way, but I'm not aware of a technique, plus Windows may keep incrementing the port number until it hits some limit (I'm going to guess 255). My only caution is that writing to the registry, particularly as a regular, repetitive action, comes with some risk of corrupting the registry if there was a program error, or it was interrupted mid-write, or something like that. I did it because we had a system with about 14 comm ports, some of which could be configured as RS232 or RS422, but the configuration normally had to be done in Device Manager and we needed an automated option. I think that that comm port assignment is done in the same area of the registry.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 4 of 7
(4,028 Views)

Some years ago I needed to make similar changes and made these changes in the visaconf.ini

There you find a section: 

[ALIASES]
Alias0 = "'LPT1','ASRL10::INSTR'"
Alias1 = "'COM1','ASRL1::INSTR'"
Alias2 = "'COM2','ASRL2::INSTR'"
Alias3 = "'COM3','ASRL3::INSTR'"
Alias4 = "'COM4','ASRL4::INSTR'"
NumAliases = 5

[ASRL-RSRC-ALIAS]
Name0 = "ASRL10::INSTR"
Enabled0 = 1
Static0 = 1
SystemName0 = "LPT1"
BaudRate0 = 9600
DataBits0 = 8
Parity0 = 0
StopBits0 = 10
FlowCtrl0 = 0
Name1 = "ASRL1::INSTR"
Enabled1 = 1
Static1 = 1
SystemName1 = "COM1"
BaudRate1 = 9600
DataBits1 = 8
Parity1 = 0
StopBits1 = 10
FlowCtrl1 = 0
Name2 = "ASRL2::INSTR"
Enabled2 = 1
Static2 = 0
SystemName2 = "COM2"
BaudRate2 = 9600
DataBits2 = 8
Parity2 = 0
StopBits2 = 10
FlowCtrl2 = 0
Name3 = "ASRL3::INSTR"
Enabled3 = 1
Static3 = 0
SystemName3 = "COM3"
BaudRate3 = 9600
Parity3 = 0
StopBits3 = 10
DataBits3 = 8
FlowCtrl3 = 0
Name4 = "ASRL4::INSTR"
Enabled4 = 1
Static4 = 0
SystemName4 = "COM4"
BaudRate4 = 9600
Parity4 = 0
StopBits4 = 10
DataBits4 = 8
FlowCtrl4 = 0
NumOfResources = 5

 

I used the ini-file vis to do the changes. And keep in mind they are effective after a reboot then.

 

 

The visaconf.ini is now relocated in the documents and setting folder, and each user has a link to the all users file....

Back in the old days all processes where running as root 😉 maybe the file access rights need to be changed.

Seems that there is a way with the  MAX Copy Configuration.vi  to do things like this.....

  

 

Maybe a NI VISA expert can throw more light on this??

 

 


 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 7
(4,012 Views)

johnny777 wrote:

 

Problem: COM port number keep on changing every time I test plug in the same PC USB port with diffrent device/product. I know there is a way to configure the registry in the PC but I prefer to use Labview automate to force the COM port change/assign to COM port number as I have mention in my 1st forum.  Thank you.

 

 


If it is a FTDI USB chip device: I remember reading a KB article at ftdi.com about nailing the port number to a USB ID.... (don't know if profilic (?) or other USB slave chip MC  have something similar, but I thought it's worth mentioning.

 

However this involves some changes in the USB driver settings 😉  nice for your own PC but not for all customers ... but if you provide the driver maybe thats also a solution.

 

 

Message Edited by Henrik Volkers on 02-03-2010 04:42 PM
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 6 of 7
(4,010 Views)

Thank you Henrik & Putna.

 

I have a look at the  Windows reg function (see below diagram), I think it is posible to write to registry which will force COM port number alway the same e.g COM 7 every time plug in different USB. However, it is quite a complicate and very carefull when dealing with window registry.From Johnny777.

 

 

reg.GIF

0 Kudos
Message 7 of 7
(3,981 Views)