LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial ports, different terminating characters, also no device

I was told to start a new topic.

 

I have 8 serial ports:

1.  no device attached

2.  one port has a device which does not send  \n  terminating character and does not respond to IDN?

3.  6 ports that has a device attached that sends  \n character and responds to "IDN?"

 

All 8 serial ports are on a StarTech USB-serial converter.

 

What is the best way to do a VISA Read when trying to find which port has which device/no device ?

 

Windows will randomly assign serial ports and the devices can be attached to any of the 8 connectors.

 

.

 

0 Kudos
Message 1 of 6
(2,866 Views)

Use a FOR loop to go through each port.  For each port, send the *IDN? query and look at the response.  If there is no response (timeout), try the other device's protocol to detect it.  If still no response, you can assume there is no device there.


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 2 of 6
(2,860 Views)

@nyc_(is_out_of_here) wrote:

I was told to start a new topic.


Well I thought you were asked to create a new topic on your "Byte at Port" and termination character questions but this question still seems related to the "find serial ports" topic of the other thread...

 


@nyc_(is_out_of_here)

Windows will randomly assign serial ports and the devices can be attached to any of the 8 connectors.


I have found that Windows 7+ will remember the UUID of the USB to Serial adaptors and applies the same Com port designator to the same device every time. This is why when you look in the Device Manager you will see serial ports marked as "in use" when no serial ports are present in the system.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 6
(2,836 Views)

@RTSLVU wrote:

@nyc_(is_out_of_here) wrote:

I was told to start a new topic.


Well I thought you were asked to create a new topic on your "Byte at Port" and termination character questions but this question still seems related to the "find serial ports" topic of the other thread...

 


@nyc_(is_out_of_here)

Windows will randomly assign serial ports and the devices can be attached to any of the 8 connectors.


I have found that Windows 7+ will remember the UUID of the USB to Serial adaptors and applies the same Com port designator to the same device every time. This is why when you look in the Device Manager you will see serial ports marked as "in use" when no serial ports are present in the system.


It is a new topic because I've found the serial ports.

 

Now I need to know which devices (or lack thereof) are on those serial ports given that one of the devices does not send a terminating  \n.

 

When the LabVIEW software runs on another PC, serial ports are not the same.

I have experienced this first hand because the employer switched me to a different laptop but connected to the same StarTech USB-serial device.

 

 

.

 

0 Kudos
Message 4 of 6
(2,815 Views)

If your project has a budget of any kind you could consider switching to one of these things and standardizing which port you plug which device into instead of doing random probing...

0 Kudos
Message 5 of 6
(2,807 Views)

@nyc_(is_out_of_here) wrote:

 

Now I need to know which devices (or lack thereof) are on those serial ports given that one of the devices does not send a terminating  \n.

 

When the LabVIEW software runs on another PC, serial ports are not the same.

I have experienced this first hand because the employer switched me to a different laptop but connected to the same StarTech USB-serial device.

  


Oh well sure if you move to a different computer, that computer is not going to know what the UUID and ports were on the other computer.

 

But you should only have to figure that out once, and it should stay the same from then on...

 

Anyway it seems like the process of elimination is what comes to my mind first. 

  1. Find all serial ports
  2. *IDN? query the ports one at a time keeping track of what instrument is on what port
  3. The one port that does not respond to the *IDN? is probably that "other" instrument
    1. Send a command specific to that instrument and see if it answers correctly.
  4. If more than one port does not respond to the *IDN? 
    1. Then you have other problems to warn the user about.
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 6
(2,805 Views)