From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

detect serial port went "down"

I am writing a LabVIEW program that sends bytes to a custom PCB via serial port.

The custom PCB always responds with 127 bytes.

 

I have a VI that initializes the serial port then has a VISA Read inside a WHILE loop.

 

Everything works great unless power to the PCB is turned off.

 

When the power is turned back on, Bytes at Port is greater than 127 and everything is out of whack.

 

How do I detect that a serial port has gone down?

 

I have attached a VI of the WHILE loop.

 

.

 

0 Kudos
Message 1 of 2
(1,712 Views)

Does the custom PCB send a string, particularly one ending in 0xA (Line-Feed)?  If so, use Enable Terminator Character and ask to read 1000 bytes (it should stop at 127).

 

Otherwise, ask to read 1000 bytes and test to see if you got 127.  If not, worry about it.

 

Bob Schor

0 Kudos
Message 2 of 2
(1,694 Views)