Example Code

Emergency VI Aborter

Code and Documents

Attachment

Download All

Overview

This example allows you to abort any perpetually running VI in LabVIEW.

 

Description

While it's always advisable to gracefully handle stopping your VIs within the VIs themselves, we've all run into the situation where we've created an infinite loop or some other wiring blunder that has left our VI running perpetually. 

 

While working on a top level application (with the run and abort buttons hidden) I kept running into this problem while hunting down a particularly tricky bug and I found myself in a situation where even the trusty Ctrl+. step wouldn't stop my VI.  I wrote this small VI to provide an easy way to abort any running VI through VI server.

 

This VI is designed as a utility therefore it will run when opened and close when stopped.  If you would like to view the source code you will need to press Ctrl+. while it is running to stop it (it filters itself out of the list of 'abortable' VIs).

 

NEW: I've added another version that will abort all running VIs, even if they are modal.  It will run when opened, find all running VIs, abort them, then close itself.  Since it doesn't require any front panel interaction, it works for modal windows.

  

Requirements 

Software

  • LabVIEW 8.0 or later 

Hardware

  • N/A

 

Steps to Implement or Execute Code

     1. Download and open the Easy VI Aborter example VI

     2. Select which VI you would like to abort

     3. Click the Abort VI button

     4. Click the Exit button when finished

 

 

Additional Information or References

 Front Panel

EasyVIAborter.png

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.** 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Ljubo
Member
Member
on

It does not work if Fron Panel Window is modal (see VI properties, category Window Appearance).

Does anybody know how to stop modal window ?

Ljubo
Member
Member
on

Excelent!

See Discussion Forums also.

GriffinRU
Member
Member
on
Jirav_Fadia
Member
Member
on

Really a nice one and truly needed....Thanks ...

1984
Active Participant
Active Participant
on

Use this for a year now. A must have!

thx.

Luis_AM3C
Active Participant
Active Participant
on

Very Useful.

Thank you.

Luis A. Mata C.
Ing. Electrónico
Whatsapp: +58-414-1985579
BBM Pin: 2B83E99A
Thanks: Kudos
Teo7
Member
Member
on

This VI implements a true LabVIEW “Emergency Stop”!

I believe this a most fundamental feature, somehow still missing from the LabVIEW development platform!

It is truly essential during development, especially if you are building large-scale applications.

I have used LabVIEW for many years, and I have never understood why it does not provide the equivalent of an "Emergency Stop". In other words a way of stopping execution of all Vis or a specific VI under a headlock situation. Without it, the only solution is to terminate LabVIEW through the Windows Task Manager! Ctrl+.

A simple example of a nasty headlock situation is this:

Imagine that during development and after having terminated execution using “Ctrl+.” you forget to close a modal pop-up window, which has been accidentally left open. You then run a VI that contains the modal window in its block diagram... This minor mistake, which is unfortunately very easy to occur, is enough to cause complete loss of control of the development platform. The only solution (without the “Emergency VI Aborter”) is to terminate LabVIEW, restart it, and hope to be able to recover any unsaved changes. What is worse, if you were in the middle of a complicated debugging process when the headlock occurred, this also means you have lost the setup and your probes.

I have needed such a fundamental feature almost every single day of development in LabVIEW and it is simply not there, which really does not make sense. I think we should put this forward for NI to implement in one of the following versions of LabVIEW if not already done so.

Thanks so much.

Theo