LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to scan COM ports and get their information such as location using Labview?

Solved!
Go to solution

@RavensFan wrote:

While *IDN? is the default query in MAX, not many things you connect to in the real world will respond to it.  It is a carry over from the "instrument" class of devices like oscilloscopes and multi-meters, and analyzers.

 

You need to figure out if there is a particular command that the devices on the other end of your serial/BLE dongles will respond to and give back information that is unique to them, such as a serial number, or perhaps some memory location you can put an identifying code into.


If they are USB instruments, there is a standard protocol for getting S/Ns.  You can access the S/N with this:

sn.png

but beware: If an instrument doesn't support S/N's then NI MAX will just make up a random one every time it sees the instrument.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 11 of 34
(2,553 Views)

@RTSLVU wrote:

Also I have found that Windows 7 and newer tends to "remember" what USB-serial adapter was given what port number and always gives it the same one regardless of what USB port it's plugged into.


That depends more on the driver for the USB serial adapter than Windows. Some (such as FTDI) try to map a serial port to a specific COM port based on the internal serial numbers. Many other manufacturers do not attempt to do anything specific and if it is not solved in the driver itself, the only thing Windows has to uniquely identify a device is the USB port and hub to which it is connected, as the serial number of the interface device is not a standard feature of the USB specification.

Rolf Kalbermatter
My Blog
0 Kudos
Message 12 of 34
(2,525 Views)

@rolfk wrote:

@RTSLVU wrote:

Also I have found that Windows 7 and newer tends to "remember" what USB-serial adapter was given what port number and always gives it the same one regardless of what USB port it's plugged into.


That depends more on the driver for the USB serial adapter than Windows. Some (such as FTDI) try to map a serial port to a specific COM port based on the internal serial numbers. Many other manufacturers do not attempt to do anything specific and if it is not solved in the driver itself, the only thing Windows has to uniquely identify a device is the USB port and hub to which it is connected, as the serial number of the interface device is not a standard feature of the USB specification.


According to Microsoft, the serial number is defined in the USB_DEVICE_DESCRIPTOR.  I think the real reason is that hardly anyone makes use of the field.  Many (most?) manufacturers of USB devices even duplicate serial numbers; I have to think they're saving money somehow by doing this.  (Besides being an extreme inconvenience, there's no traceability - but that's another issue for another day...)

 

From Microsoft:

iSerialNumber

Specifies a device-defined index of the string descriptor that provides a string that contains a manufacturer-determined serial number for the device.

 

I guess Microsoft forgot to say that the string needed to be unique to each unit.  😉

.

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 13 of 34
(2,502 Views)

I had a look at the user guides for the BLED112 BLE receivers I am using and it seems like they didn't add a unique identifier as an answer for an information request. So I am screwed in that sense. 

 

The only way I say it possible is to find a way to track where the COM port is connected to physically (Hub ####, Port ###).

 

If anyone has any ideas of this please let me know.

 

Cheers

0 Kudos
Message 14 of 34
(2,496 Views)
Solution
Accepted by dadest100

@dadest100 wrote:

I had a look at the user guides for the BLED112 BLE receivers I am using and it seems like they didn't add a unique identifier as an answer for an information request. So I am screwed in that sense. 

 

Granted I have never used this module but...

 

In the the BLEGUI manual there is a section on the "commands menu" starting on page 29

 

4.4 Commands menu
The commands toolbar contains some useful functions.

 

One of the commands available is:

 

Get Address
Reads the address of local device.

 

Have you tried that? 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 15 of 34
(2,483 Views)

Agree with this COM port troubles and I don't know good solution for USB-COM port adapter.

In few places when user often moves equipment I started to add a dialog which asked to set COM port. Fortunately, LabVIEW shows active COM ports. Also, usually, user could disconnect USB to check which COM port disappears.

0 Kudos
Message 16 of 34
(2,477 Views)

USB devices are the bane of my programming existence.  I will only use them as a last resort.  Nowadays, of course, it's hard to find a computer with a COM port, but at least with a desktop computer, you can add a card.  With a laptop, you (almost) have no choice.  Older laptops sometimes had COM ports built-in, or at least built into their docking stations.  😞

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 17 of 34
(2,471 Views)

Is there any kind of learning process you could apply when setting up a test?

 

This feels comparable to the tire pressure monitoring system in my car.  Each tire has a pressure sensor, and the car dashboard will report each tire's pressure.  (left front, right rear, etc.)  However the car doesn't know which sensor relates to which position until you teach.  If you move things around by rotating your tires, then you need to teach it again.

 

The learning process is that the car tells you to go to a specific tire to let the air out.  Once you do that, the car know which sensor is related to "driver front" because is saw the loss of pressure from that sensor.  Then it tells you to move onto another tire and repeat.  Once you have done all 4, now it knows which pressure sensor relates to which position.  (The nuisance part is now you need to put air back in all the tires!)

 

Can you do that as part of a setup in your process.  Let the computer look at all com devices.  It tells you to go to a specific one and you do something, (hit a button, change the parameter being read, ....) then it know which com port is connected to which logical device.  Then repeat for all devices?  It then stores them until things change or you tell it to do it again.

Message 18 of 34
(2,469 Views)

I am confused. I don't remember any COM port device with "HIT" button.

In the past I created an instrument where application sends "unique" command to recognize COM port device. That works fine except 2 cases

- instrument has more than one the same COM port device without any specific identifier, like serial number or unique length of stage device

-  there are additional COM port devices which provide very small chance to be recognized as device in the instrument

Unfortunately, program becomes more complicated and it is usually simpler to come and connect/disconnect COM port

 

0 Kudos
Message 19 of 34
(2,459 Views)

@Vasilich2004 wrote:

I am confused. I don't remember any COM port device with "HIT" button.

 


Then press the ANY key on your keyboard!

 

I'm talking about whatever device is connected to this com port.  We haven't been told what they are or what their capabilities are.  If it has something on it.  (a reset button, heck even the power button) something a person could physically do to it that would allow a piece of software monitoring it to know that something occurred.

0 Kudos
Message 20 of 34
(2,455 Views)