02-09-2017 02:15 AM - edited 02-09-2017 02:23 AM
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
02-09-2017 05:29 AM
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.
02-09-2017 05:35 AM
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).