12-15-2022 05:33 AM
@constructionworker wrote:
Thanks for your answer.
Actually, I didn't think much of sticking to com port numbers.I actually did a little test. I tried the devices I have on computers of the same version and I got an output like the one below with the same port location numbers.
The port number changes according to the port the device is plugged into. They show the same number on computers of the same version.
Can something be done with the location information here? So it's like reading the compport number in location.
And what would that help. You may maybe know in which physical port the device is plugged in but still not if it is camera XYZ pointing at your front door or camera ZYP pointing at your backyard. And anyone going to do a "quick" test by swapping the connectors will mess up your assumptions.
So the question is, what do you really want to standardize on? A port somewhere on your computer that has practically no meaning unless you have exactly the same hardware (and then say in your manual "plugin camera XYZ in the second USB port from the left on the back side") or something that is more meaningful to users and less hardware specific.
12-15-2022 06:24 AM
I would not worry at all about the Serial Device Enumerator. Plug n play uses the Serenum HKEYS to pseudo assign a COM Port enumerator to each device. It is possible to hack into the HKEY registry entries using the Windows Registry API but this is potentially dangerous if you don't know everything about every target machine and someone will plug in a strange USB device somewhere and start questioning the developer's mother's fidelity, species and state of grace while filling the nearest "Swear Jar." Better; use the System Configuration API to programmaticly assign Aliases to your devices by serial number and use a Configuration file to hold key information.
12-15-2022 06:45 AM
If the cameras have readable serial numbers, you may be able to use this:
12-15-2022 08:14 AM
@constructionworker wrote:
There may be serial numbers that can change. Devices with different serial numbers can be installed from the same product.
I think I've explained the problem a little bit.
If the serial numbers change then they are not serial numbers. Not in any traditional sense wherein serial numbers provide a unique identifier to a piece of hardware.
If what you mean to say is that the serial numbers will not be the same across different systems or that converters may get swapped out, then you will need to provide a method to configure the identity of each camera. There is no way around that.
Assuming hardware is not constantly swapped out, this should be a one time setup task.
@constructionworker wrote:
Thanks for your answer. I've seen the example you have before. This example doesn't work very well in this regard.
I guess I can't explain the problem fully.
Let me try to explain in more detail.I have AHD converters and I want to connect them to a usb input that I specified.
For example:
usb port 1
usb port 2
usb port 3
When a video converter is plugged into either of these ports, it should get a fixed com port number. Because I am trying to create an application that works without user intervention.
How do you define USB1, USB2, etc? And if this needs to be distributed on multiple systems, I doubt there is any guarantee the USB ports will enumerate in the same order.
12-15-2022 08:28 AM - edited 12-15-2022 08:36 AM
@rolfk wrote:
And what would that help. You may maybe know in which physical port the device is plugged in but still not if it is camera XYZ pointing at your front door or camera ZYP pointing at your backyard. And anyone going to do a "quick" test by swapping the connectors will mess up your assumptions.
So the question is, what do you really want to standardize on? A port somewhere on your computer that has practically no meaning unless you have exactly the same hardware (and then say in your manual "plugin camera XYZ in the second USB port from the left on the back side") or something that is more meaningful to users and less hardware specific.
The products to be used will always be the same products. For the sake of understanding, hypothetically, maybe 100 work systems are used with the same materials. exactly the same company products.
@ JÞB wrote:
I would not worry at all about the Serial Device Enumerator. Plug n play uses the Serenum HKEYS to pseudo assign a COM Port enumerator to each device. It is possible to hack into the HKEY registry entries using the Windows Registry API but this is potentially dangerous if you don't know everything about every target machine and someone will plug in a strange USB device somewhere and start questioning the developer's mother's fidelity, species and state of grace while filling the nearest "Swear Jar." Better; use the System Configuration API to programmaticly assign Aliases to your devices by serial number and use a Configuration file to hold key information.
Can you give an example of how this can be done?
@paul_cardinale wrote:
If the cameras have readable serial numbers, you may be able to use this:
@ Jim B wrote:
@constructionworker wrote:
There may be serial numbers that can change. Devices with different serial numbers can be installed from the same product.
I think I've explained the problem a little bit.
If the serial numbers change then they are not serial numbers. Not in any traditional sense wherein serial numbers provide a unique identifier to a piece of hardware.
If what you mean to say is that the serial numbers will not be the same across different systems or that converters may get swapped out, then you will need to provide a method to configure the identity of each camera. There is no way around that.
Assuming hardware is not constantly swapped out, this should be a one time setup task.
@constructionworker wrote:
Thanks for your answer. I've seen the example you have before. This example doesn't work very well in this regard.
I guess I can't explain the problem fully.
Let me try to explain in more detail.I have AHD converters and I want to connect them to a usb input that I specified.
For example:
usb port 1
usb port 2
usb port 3
When a video converter is plugged into either of these ports, it should get a fixed com port number. Because I am trying to create an application that works without user intervention.How do you define USB1, USB2, etc? And if this needs to be distributed on multiple systems, I doubt there is any guarantee the USB ports will enumerate in the same order.
The project I want to create will always use the same computer version and the same converter version. But they probably may not have the same serial numbers. In this case, there is a possibility that the com port will change, so finding the com port assigned to the physical port seems like the most logical method for now, but I have no idea how to do it.
If I can find the compport assigned to the physical port;
plug camera -1 into a physical port-1
I say plug camera 2 into port-2.
and this way I would have solved my problem as I knew which camera was plugged into which physical port.
Any ideas on this?
12-15-2022 08:46 AM
I'm a little confused. When I open MAX, it tells me what devices are plugged into my computer (camera, DAQmx device, printer, communication device, etc.). Can you post a screen-shot of your PC, running MAX, and showing Devices and Interfaces? I'm assuming (??) that your Com Ports will show up as "something". Here's an example:
If you can "see" your Com Ports, you should (I hope) be able to "interrogate" them to discover what is attached, and if a Camera, what is its Serial Number. Once you do that, you know (from the Serial Number) which Com Port has Camera 1 and which Com Port has Camera 2, and don't care into which USB connection on your PC is being used.
Bob Schor
12-15-2022 09:02 AM
@Bob_Schor wrote:
I'm a little confused. When I open MAX, it tells me what devices are plugged into my computer (camera, DAQmx device, printer, communication device, etc.). Can you post a screen-shot of your PC, running MAX, and showing Devices and Interfaces? I'm assuming (??) that your Com Ports will show up as "something". Here's an example:
If you can "see" your Com Ports, you should (I hope) be able to "interrogate" them to discover what is attached, and if a Camera, what is its Serial Number. Once you do that, you know (from the Serial Number) which Com Port has Camera 1 and which Com Port has Camera 2, and don't care into which USB connection on your PC is being used.
Bob Schor
Yes, I can see the serial numbers, both are different.
Well, let's say we found the comport assignment according to the serial number of the 2 converters I have now, but what will happen if converters with different serial numbers are used in the application after creating and distributing the application?
12-15-2022 10:52 AM - edited 12-15-2022 10:53 AM
Where are the COM ports in that image, you have been talking all the time about?
VISA is not coming into the picture at all here. But the principle of using IMAQdx functions to enumerate the camera and read any serial number would be similar.
12-15-2022 11:17 AM
@constructionworker wrote:
@Bob_Schor wrote:
I'm a little confused. When I open MAX, it tells me what devices are plugged into my computer (camera, DAQmx device, printer, communication device, etc.). Can you post a screen-shot of your PC, running MAX, and showing Devices and Interfaces? I'm assuming (??) that your Com Ports will show up as "something". Here's an example:
If you can "see" your Com Ports, you should (I hope) be able to "interrogate" them to discover what is attached, and if a Camera, what is its Serial Number. Once you do that, you know (from the Serial Number) which Com Port has Camera 1 and which Com Port has Camera 2, and don't care into which USB connection on your PC is being used.
Bob Schor
Yes, I can see the serial numbers, both are different.
Well, let's say we found the comport assignment according to the serial number of the 2 converters I have now, but what will happen if converters with different serial numbers are used in the application after creating and distributing the application?
You will need some 1 time setup. Let's use your screenshot. And assign Alliases as:
Plug n pray will remember the UID of each device and reuse the Aliases whenever the same device is plugged into your exact machine even if the exact USB path swaps. But, if you need to replace the camera "DogPark" with a new one, (because, it was damaged by someone angry over the ticket, of course!) You need to reconfigure. It's simple to use the System Configuration API to list all detected devices by serial number and Aliases and you could even assign a new Alias to any present device that has a default "camN" Alias. Look in my tag cloud for a relevant tag. I'm sure there is a rename Alias.vi example in there somewhere.
12-15-2022 12:18 PM
@paul_cardinale wrote:
Try this instead
Great solution Paul, kudo given. That being said I am confused why the Clear Error VI is password protected, when I certainly hope it just clears an error. And there are some interesting design choices with dialogs and silver controls. But the parsing of the Name Caption and Description is very useful.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord