LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

find all serial ports on PC

I am using the Find VISA Resources and it works great except for com ports that do not have a device attached.

 

In that case I get the following error pop-up.

How do I handle it?

 

Untitled.png

0 Kudos
Message 11 of 16
(1,958 Views)

Clear the error if its a timeout.

 

errrrCapture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 12 of 16
(1,950 Views)

@RTSLVU wrote:

Clear the error if its a timeout.

 

errrrCapture.PNG


Got it. Thanks!

I was thinking I may be missing a better method than that.

 

What is your opinion of using Bytes At Port?

 

I have 8 ports. One is unused. One has a device that does not send  '\n'

and six others that do send   '\n'  .

 

 

.

0 Kudos
Message 13 of 16
(1,938 Views)

What does that one device that doesn't use \n do in its protocol to tell you when the message ends?

 

That's really a different question.  This question was about finding the serial ports.  It isn't affected by what protocol the devices use to communicate.

0 Kudos
Message 14 of 16
(1,930 Views)

@nyc_(is_out_of_here) wrote:

What is your opinion of using Bytes At Port?.


It is evil to wire it to the VISA Read.  You ONLY good use of the Bytes At Port is to see if any data has come in.  Once you see data come in, then you use the protocol of the device to read the entire message.  Never depend on the Bytes At Port to state when a message is complete because you will hit the race condition and you will not get all of your data.  If the message length is fixed, then just read that number of bytes.  If your message uses the termination character, then tell VISA Read to read more bytes than would ever be in the message and let it stop reading when it finds that termination character.  If some other weird binary protocol, implement that protocol.

 

As was said, that is another topic.  If you have more questions, start a new thread.


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 15 of 16
(1,920 Views)

@crossrulz

As was said, that is another topic.  If you have more questions, start a new thread.


The new thread is   https://forums.ni.com/t5/LabVIEW/serial-ports-different-terminating-characters-also-no-device/td-p/3...

 

 

.

0 Kudos
Message 16 of 16
(1,915 Views)