LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get vi close event..??

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..

 

0 Kudos
Message 1 of 5
(3,680 Views)

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.

0 Kudos
Message 2 of 5
(3,677 Views)

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.

 

0 Kudos
Message 3 of 5
(3,631 Views)

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.

0 Kudos
Message 4 of 5
(3,611 Views)

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

0 Kudos
Message 5 of 5
(3,596 Views)