03-20-2018 02:34 AM
Hi, I am beginner of LabVIEW programming. Recently I have a case that I need to insert a sub VI into my main VI's front panel by using sub panel method. Then I have a question that how I could do error handling on my inserted sub VI. As shown below, I am inserting a sub VI "Sub IO.vi". My understanding of the error our of Invoke Node "Run VI" and "Insert VI" is the error whether this particular function is running properly. How could I get the error info of functions inside the sub VI, If I want do error handling, for instance, based on error status, go to different machine states in Main VI?
03-20-2018 03:14 AM
One of the way is inside a sub vi (which you are calling) use case, wire error cluster to the case selector. If you get a error "error" case will execute. In that error case use a FGV(Functional Global Variable) to set error, Read that FGV in your main VI to go to different states based on error.
03-20-2018 03:22 AM
Dear ELNO,
Thank you very much for your reply. I will try what you suggested. Thank you!
03-20-2018 03:36 AM
If you instead of VI server use Asynchronous call you can do a Collect afterwards. The sub VI must finish first, ofcourse.
/Y
03-20-2018 03:42 AM
Dear Yamaeda,
Sorry I don't know what is "Asynchronous call". That is out of my current coverage. Thank you for your suggestions and I will get info of this "Asynchronous call" first.
03-20-2018 05:18 AM
Start Asynchronous Call (found on the Application Palette) is one way to start a sub-VI running without having it explicitly being placed on your Block Diagram. It allows you to specify when you want your parallel, asynchronous VI to start running.
As Yamaeda mentions, if your Asynchronous VI, itself, exits on Error, you can use code in the Main VI to trap the error. However, it seems "cleaner" to me to set up a "communicate Error" routine to allow the Clone to signal its problem directly to the Main VI.
Bob Schor