Halting VI and Application Execution


LabVIEW gives you a couple of functions to abort the execution of your code immediately: Stop and Quit LabVIEW, which are found on the Programming>>Application Control palette.

Stop Function

The Stop function has a Boolean input. When TRUE (which is the unwired default input), it halts execution of the VI and all its subVIs, just as if you had pressed the stop button on the Toolbar.

Quit LabVIEW Function

The Quit LabVIEW function does just that, when its input is TRUE (also the default). Be careful with this one.

Some of us reminisce about a third function that was included back when LabVIEW was in version 2.2: Shutdown. On certain Macintosh models, this function would effectively turn off the whole computer, monitor and all. We never understood how it could be useful, but it was fun to leave a colorful VI running with one big button that said "DO NOT PRESS THIS BUTTON" on someone else's Mac, and then just wait to see who would be too curious . . . . The button was, of course, connected to the operating system's Shutdown function. It was a good way to amuse ourselves at the expense of the less-experienced LabVIEW users.

On a serious note, however, you should use these functions with caution. It is considered bad programming etiquette (in any language) to include a "hard stop." Strive to always have a graceful way to exit your program.

Make sure your VI completes all final tasks (closing files, finishing the execution of subVIs, etc.) before you call the Stop function. Otherwise, you may encounter unpredictable file behavior or I/O errors, and your results can be corrupted.





LabVIEW for Everyone. Graphical Programming Made Easy and Fun
LabVIEW for Everyone: Graphical Programming Made Easy and Fun (3rd Edition)
ISBN: 0131856723
EAN: 2147483647
Year: 2006
Pages: 294

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net