LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous Serial Write/Read and detect if the connect with MCU is lost

Hello,

I am trying to control MCU(ex:arduino) by Labview. What I have finished so far is that I can continuosly send commands to MCU and read the feedback from it by RS-232. Now the problem is when the connection between PC(labview) and MCU is failed, such as MCU is out of power or the RS-232 cable is broke, we won't be able to recieve the feedback from MCU and the program may stuck. What I want to do is to keep detecting whether the connection(the complete process includes write and read)  exsists and will stop the serial read/write immediately when connection is lost to prevent from program stops. The way I tried now is to put a "Empty String/Path?" function on the read buffer channel of  "VISA Read" function block to detect whether if the feedback is empty and will disable the read/write if it happens, but it seems not to work well (program will still stuck when the feedback is empty). Does anyone know how to solve this problem? My reference program is as the attachment(from labview example). 

Many thanks!

Ian

0 Kudos
Message 1 of 3
(4,112 Views)

I guess I'll say this right now.  Your chosen avatar is going to make me not want to follow this thread.  I am not going to look at a topic with a page full of blinking lights.

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 2 of 3
(4,065 Views)

If you lose connection, then the VISA Read should have a timeout error.  If you want to wait less than 10 seconds, then just change the timeout (part of the Configure Serial Port).


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 3 of 3
(4,063 Views)