LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect by program the COM number associated to a specific instrument

Hello. I need to detect automatically through Labview which COM port number is associated to the various intruments that are connected to the board to be tested. I imagine that I have to use some property of the device shown on the computer as an input of a function that gives me the corresponding COM number. This could avoid to have error of exchange the number of COM when there is more than one instruments connected and you have to select manually the COM.

0 Kudos
Message 1 of 11
(509 Views)

Hi V.,

 


@V.Life wrote:

I need to detect automatically through Labview which COM port number is associated to the various intruments that are connected to the board to be tested.


In general an "autodetect COM port with device" feature works by:

  • get all available COM ports (VISAFindResource)
  • send a command to the COM port
  • when there is a response then a device is connected
  • use a command to request some unique data from your device: this way you can detect the type/model/serial of the connected device…

When you want to detect several "same" devices you easily get in trouble when those devices don't support things like UUIDs or serial numbers…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(499 Views)

What it is possible to do if they have UUID instead?

0 Kudos
Message 3 of 11
(491 Views)

Hi V.,

 


@V.Life wrote:

What it is possible to do if they have UUID instead?


Read the UUID and check with your reference table of UUIDs: now you know which device is connected to your COM port…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(487 Views)

Thank you. How can I get UID (or other info that can be used to identify the device)?

0 Kudos
Message 5 of 11
(478 Views)

Hi V.,

 


@V.Life wrote:

How can I get UID (or other info that can be used to identify the device)?


By sending an appropriate command to your device and reading its response.

 

Do your devices support such features at all?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(450 Views)

If I assing a name to the device in NI MAX (as default it is equal to COMxx corresponding to ASRLXX) can I find the resources by this name? I tried but I can get only the string before the name (for example ASRL39::INSTR).

0 Kudos
Message 7 of 11
(425 Views)

Hi V.,

 


@V.Life wrote:

If I assing a name to the device in NI MAX (as default it is equal to COMxx corresponding to ASRLXX) can I find the resources by this name? 


Sure: instead of "COMxx" you simply use the alias name as VISA resource.

 

But: this only allows to decouple device alias from COM port instance. It will NOT "find" or "detect" a device…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(411 Views)

It could be a solution if I search for the name, find the ASRLXX and then set COMXX as port for the "NAME" device.

0 Kudos
Message 9 of 11
(384 Views)

Hi V.,

 


@V.Life wrote:

It could be a solution if I search for the name, find the ASRLXX and then set COMXX as port for the "NAME"

device.


???

I don't know what you are talking about…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 11
(374 Views)