LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

unlimited errors loop

Solved!
Go to solution

Is there a way to stop a vi, if for some reason you forgot to clear an error and now bomb the user with the same error message each run of a loop?

I try alternately pressing escape and mouse clicking onto the stop button in the tool bar. However, the message appears again before the stop button is activated.

The task manager kills the vi, however couldn't be there a more simple way?

 

 

0 Kudos
Message 1 of 13
(3,955 Views)

You try to go in the wrong direction. Do not eliminate the error msg itself, but handle the error. If you put clear error in your code without beeing careful you just mask out the problems in your VI.

Do not create a loop which does not stop if an error happens. At least you should stop the running loop, and report about the error. If the error due to wrong programming, you fix this based on the error info. If for example this error is hardware specific (the user accidently pulls out a USB cable, etc...), you can handle it nicely in a State Machine: you move to an error state, reporting to the user there is some problem. After this you can give the option to the user to abort the whole application, or try to re-initialize the hardware. this is of course just one possible example...

 

Edit1: but if you show your actual problem, and post your VI which has this problem, we can give you more specific help...

Edit2: So just to clarify: what you explain in your post, is only due to a bad programming design. Instead of trying to treat the symptomes, why not heal the patient??

0 Kudos
Message 2 of 13
(3,947 Views)

You are right in the end, besides that i don't agree that the application should terminate completely on error.

It should of course report the error and keep running to let the user (or the programmer) be able to fix runtime errors (f.e. due to
wrongly configured input elements) and try again. Thats why i like to clear the error after it has been reported and then keep running.

Anopther case where this occurs is, when an error is produced again and again each run of the loop.

During programming, i believe, every programmer will be confronted with such situations at least sometimes.

This is due to being confronted with some intermediate state of the program code which is about to become error tolerant but is not
at the moment.

 

There should be a more simple way than using the task manager to break a vi while it displays an error message.

 

 

 

0 Kudos
Message 3 of 13
(3,933 Views)

Have a look at the attached document - it covers everything that you might want to do with errors.


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 4 of 13
(3,924 Views)

"You are right in the end, besides that i don't agree that the application should terminate completely on error."

I did not say this only, did you read my entire post?

 

You write about two cases: when the programer develops, and when the end user runs the application. I explained what I do in the second case: I have error states, and I report, and if possible, give the option to the user to re-initialize.

In the first case, when I program, I just do not create loops which can become infinite, if error happens the loop should stop, and the programmer can fix it. You can also use other debugging techniques to find the solution easier. But using the red Abort button? It is very rare I need to use it...

0 Kudos
Message 5 of 13
(3,922 Views)
Solution
Accepted by Labuser16383

Although it is good to avoid making situations with infinite loops and errors showing, it sometimes happens by oversight or unexpected behaviour.

 

If you do end up in a loop a trick that works half of the time is to hold "ctrl + ." while you are pressing ok to confirm the dialogue message generated by an error or something similar. This key combination is the shortcut for abort but being held on a keyboard oftern injects the command inbetween the offending loops iterations.

 

Kind Regards,

 

Larry


Larry Colvin
Associate Principal Engineer
Dyson Technology Ltd.

0 Kudos
Message 6 of 13
(3,911 Views)

@ Larry C.:

Thank you. This was the answer to my original intention of the question.

Although i try to handle errors i maybe should be a little bit more careful during programming.

I got more sensitive to the prevention of unlimited errors, now.

 

 

0 Kudos
Message 7 of 13
(3,893 Views)

@Larry.C wrote:

[...]

If you do end up in a loop a trick that works half of the time is to hold "ctrl + ." [...]


Another trick that works half the time is to use this - https://lavag.org/topic/11674-cr-abort-vi/.  It will allow you to stop modal messages.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 8 of 13
(3,873 Views)

Thats cool. We're now get into LabView hacking, aren't we? Just kidding.

😉

 

0 Kudos
Message 9 of 13
(3,845 Views)

@Labuser16383 wrote:

Thats cool. We're now get into LabView hacking, aren't we? 

 


Oh we can keep this going if you really want.  I've made a tool years ago that encorporate the abort VI posted earlier (or a variation of it) to abort all VIs in all running versions of LabVIEW (2011 and newer) along with other task kill, launch, restart, and file extention taking over functions and put them into the system tray.  Earlier versions had issues with projects but I'm pretty happy with the latest version

 

https://lavag.org/topic/11333-labview-tray-launcher/

http://www.brian-hoover.com/Navigation/Code%20Repository/LabVIEW/LabVIEW%20Tray%20Launcher.php

 

But yeah you get the point, handle errors to avoid this.

0 Kudos
Message 10 of 13
(3,813 Views)