11-21-2010 12:12 PM
Hi i am a begginer in labview.
I have a main Vi, and i am using a sub vi for communicating to device via COM1 (RS232).
The problem if the main vi is stopped or closed then i want to make sure that COM1 has been released.
So i want to check and close if COM1 is open in the main VI but i dont know how to get an event of vi closing or stopping..
11-21-2010 12:23 PM
You can create a filtering "panel close?" event and user it to do whatever is necessary to shut down in a predictive order.
You can even discard the event and close the panel programmatically later once all steps have completed.
How is your code structured? Do you already use an event structure?
For us it is always easiest to help if we see some code. Please attach it.
11-22-2010 11:30 AM
Well thanks for your reply..
I am using the sub vi as a background process for communicating with serial port, i doesn't open its front panel hence got an error of panel not opened. i need to have an event of vi exit or something like that.
I am attaching the diagram of the serial vi it is the modified version of the serial sample available with Lab view 7.1
please have a look and tell me how can i fit the event within this vi so that whenever this vi closes i can close the serial port opened.
11-22-2010 02:04 PM
Holy Mackerel! a 3633px x 757px jpg? Not sure what the point of that was since the VI was probably smaller than that image.
In any case I think you might benefit from going though the LabVIEW basics course. If you're trying to do what I think you don't need a notification of when the VI is done because there can be output from your VI to preserve data flow. If you use that VI and say have an ouput terminal of an error cluster (instead of handling it in this VI) then when data comes out of that error cluster you know the VI is done executing. A similar thing could be done using sequence structures, you'll know the VI is done when it goes to the next state in the sequence strucutre. This is the less prefered method.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
11-22-2010 02:54 PM
Look up how to use event structures. Do all your Comm in a timeout case and you can add events for the vi closing or other application properties