LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically determine and select VISA COM Port Binding

Solved!
Go to solution

@nikvl wrote:

 I wonder what would happen once all the COMS are assigned? Would there an error?


Tbh, I never really understood how exactly the COMs ports are assigned. But through my work I'm using a lot of USB to XXX adapters (most of the time using FTDi chips) and we have some -very- old computers running some tests. And very often we plug in a new adapter. We never came across an issue of all COM ports being used. And I think that's because they are automatically re-assigned. You will face an error if you plug more than 256 devices at the same time (if I understood well this article).

 

What also happened to me in the past is that I used the alias re-naming function in NI-max once because a computer was connected to too many stuff and it became annoying to remember and find the right one by chance, but one day, while connecting something completely different, the same alias popped-out in my VISA ressource name control, which led me to the assumption above.

0 Kudos
Message 11 of 31
(1,089 Views)

@VinnyAstro wrote:


Tbh, I never really understood how exactly the COMs ports are assigned. But through my work I'm using a lot of USB to XXX adapters (most of the time using FTDi chips) and we have some -very- old computers running some tests. And very often we plug in a new adapter. We never came across an issue of all COM ports being used. And I think that's because they are automatically re-assigned. You will face an error if you plug more than 256 devices at the same time (if I understood well this article).

 

What also happened to me in the past is that I used the alias re-naming function in NI-max once because a computer was connected to too many stuff and it became annoying to remember and find the right one by chance, but one day, while connecting something completely different, the same alias popped-out in my VISA ressource name control, which led me to the assumption above.


Yeah I use lots of USB fr communication but most of the time the USB-serial interface is a single, separate, constant part that I work with so I never really thought about how this might influence the COM ports other than occassionally manually reassigning them in the device manager. However, I have a hunch about how I might get around this but I'm currently away from my instruments. Will report back if it pans out.

0 Kudos
Message 12 of 31
(1,074 Views)

Otherwise, given your initial problem, in my company we have somehow a similar issue: We have a lot of already connected devices, and it's a pain to go through all of them and find the right one. So I developed this VI that automatically detects when a device is connected to a COM port and automatically sends this out (or in my case connects to it)

I've made it more "general case" than what I use it for.

 

It does require that your device is not connected when you run the VI though.

 

Hope this helps.

VInny.

 

 

0 Kudos
Message 13 of 31
(1,073 Views)

@nikvl wrote:

 

Yeah I use lots of USB fr communication but most of the time the USB-serial interface is a single, separate, constant part that I work with so I never really thought about how this might influence the COM ports other than occassionally manually reassigning them in the device manager. However, I have a hunch about how I might get around this but I'm currently away from my instruments. Will report back if it pans out.

I personally never had to manually reassigned anything. I've never faced any duplicates in the COM port or errors due to something similar to this. So I assumed that windows is friendly enough to do that by himself (which could lead to the issue I had where a device's alias that I named "Motor" was used for a completely different device...)

0 Kudos
Message 14 of 31
(1,066 Views)

@VinnyAstro wrote:

Otherwise, given your initial problem, in my company we have somehow a similar issue: We have a lot of already connected devices, and it's a pain to go through all of them and find the right one. So I developed this VI that automatically detects when a device is connected to a COM port and automatically sends this out (or in my case connects to it)

I've made it more "general case" than what I use it for.

 

It does require that your device is not connected when you run the VI though.

 

Hope this helps.

VInny.

 

 


Thank you. This looks interesting, will have to try it out when I get back. Say, did you do something to the .vim search 1D-Array? Yours outputs a boolean and the standard LabVIEW one the index of element...

0 Kudos
Message 15 of 31
(1,059 Views)

nope, I'm using the Search Sorted 1D Array.vim located here which is different from the Unsorted one. And because Find VISA already sorts the array...

VinnyAstro_0-1660830773572.png

 

I still need to update my QD shortcut for it, s1d was practical, but still send to the "normal" search 1d array vi which apparently is not supported anymore

 

0 Kudos
Message 16 of 31
(1,037 Views)

@VinnyAstro wrote:

I still need to update my QD shortcut for it, s1d was practical, but still send to the "normal" search 1d array vi which apparently is not supported anymore


The primitive is still supported, it just isn't in the palettes anymore.  But if you dig deep enough in the VIM, you will find the primitive.


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 17 of 31
(1,029 Views)

 


@crossrulz wrote:

 

The primitive is still supported, it just isn't in the palettes anymore.  But if you dig deep enough in the VIM, you will find the primitive.

Yes that's true, I found it once, but I just find annoying to not have the easy shortcut working and have to adjust it 🙂

0 Kudos
Message 18 of 31
(1,024 Views)

@VinnyAstro wrote:

 


@crossrulz wrote:

 

The primitive is still supported, it just isn't in the palettes anymore.  But if you dig deep enough in the VIM, you will find the primitive.

Yes that's true, I found it once, but I just find annoying to not have the easy shortcut working and have to adjust it 🙂


Give this thread a good look through: https://forums.ni.com/t5/LabVIEW/Search-1D-Array-Changed-in-2020-SP1/m-p/4114744.  Somewhere in there are a couple of setup VIs for adding the primitive back into the palette.  I don't remember if the primitive was added back in 2021 or if I "fixed" it a long time ago.


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
Message 19 of 31
(997 Views)

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

Message 20 of 31
(972 Views)