LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comment arrter un programme a tout moment

Solved!
Go to solution

Bonjour,

J'ai un programme Labview avec plusieurs boucles "for" qui tournent les unes après les autres et je voudrais pouvoir arrêter le programme à tout moment avec le même bouton et même lorsque une boucle est lancée. J'ai bien essayé avec la fonction STOP mais je ne sais pas comment faire pour que le même bouton génère l'arrêt de n'importe quelle boucle à tout moment. Quelqu'un aurait-il une idée ?

Merci par avance,

David

0 Kudos
Message 1 of 5
(2,965 Views)

David, there are a few ways to do this.

 

  1. Turn off the latching mechanism of the stop button (Set "Mechanical Action" to "Switch when Released"), create a local variable to the button and read it in all loops. POSSIBLE BUG!! Make sure to re-initialize the button to false at the beginning of the program otherwise the state left from the previous run will cause the code to abort immediately.
  2. If you are using an event structure, my preferred method for solving this is to create a notifier and send a notification of the stop event. In every loop that you wish to stop, place a "wait on notification" primitive and set the input "ignore previous" to FALSE and "timeout in ms" to 0. Every notifier will see the stop condition. ANOTHER POSSIBLE BUG... If you place the "wait on notification" inside a SubVI in order to modularize your code, you will need to set the execution options in VI properties to allow reentrancy as well as check the box for pre-allocate clone for each instance. If you use a SubVI and don't make it a pre-allocated reentrant, then only the first instance will see the stop command.
Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 2 of 5
(2,940 Views)

Hi Charles,

 

Tks for your answer but I haven't solve my problem yet.

 

In 1, I dont think you can use that way. That's what i fisrt thought but you can only create input local variable, am i right ? (otherwise i dont know how to create an output one ... would be great to do so). So as i have one command and few STOPs, it doesnt work. (im not an advanced labview user so maybe (very possibly) i wrong)

In 2, sounds good but even with the exemples in help i cannot make it ... maybe to difficult for my level.

 

Any other advices ?

0 Kudos
Message 3 of 5
(2,922 Views)
Solution
Accepted by topic author David1382
Simply right click on the local variable and choose "Change to read". As for the notifier, when I get to my development machine I will send you an example.
Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 4 of 5
(2,920 Views)

Wow !! As simple as that 😄 !! Thanks a lot ! It works now 🙂

0 Kudos
Message 5 of 5
(2,918 Views)