LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI should not stop if COM port not found

I have attached a VI, which receives data from COM port, process it & store it in a file.

It gives, error in two cases, pic also attaced,

1. If no COM port is mentioned: VI terminates. I want that if no COM port is found, a POP up window should appear asking user to select COM port.

2. COM port receive timeout: If COM port is found, but no data receive. I want that system should keep on waiting for data, instead of terminating VI.

 

Also
1. During saving in file, if error occur, it should wait for new values & retry again, instead of error.

 

 

 

 

Download All
0 Kudos
Message 1 of 4
(2,908 Views)

You are combining the error from the visa read and file IO into the stop condition of the while loop, so simply don't do that. Just use "clear errors" to either clear all errors or just the timeout error, depending on what you want. Typically you would open the file before the loop and close after. It is not efficient to constantly open and close the same file with every iteration of the loop.

 

The popup can just be a dialog type subVI that tests if the new entry is a valid serial port.

 

From your questions I assume you did not write this code. How familiar are you with understanding and editing LabVIEW programs? 

0 Kudos
Message 2 of 4
(2,887 Views)

Hi,
1. Will check the link provided.

2. this Vi is entirely made by me. I am just make program in labview rarely. Thats why. 
Just saw some example code, took references from there & from answers from previous post, & made it.

0 Kudos
Message 3 of 4
(2,878 Views)

The Error Line is not just a "decoration" -- it is a LabVIEW Wire, carrying Data!  Try dropping a Case Structure "on top of" an Error Line -- the Error Line will "disappear" under the Case Statement.  Break (click on and hit "Delete") the Error Line just in front of the Case, wire it to the Case Selector (and notice how the Case changes appearance), wire it into and through the Case (notice you get an "empty" tunnel on the output side) and reconnect it to it's "broken end".

 

You should now have a Case Statement with "No Error" (green) and "Error" (red) Cases, and a missing Error Line in the "Error" Case (go ahead and wire it, which will "fix" the output Tunnel).  Put this construct anywhere you want to "trap" and "fix/handle" an Error.  Note that there is a Clear Error function on the Dialog Palette -- you can Clear Error, then execute your code to fix the Error and Try Again.

 

Bob Schor

0 Kudos
Message 4 of 4
(2,857 Views)