LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop a for loop executing inside an event from the front panel

Solved!
Go to solution

Hi all,

 

I've been asked to add a Stop button feature to a vi that someone who is no longer with us wrote. They have written a 'for loop' thats functionality is to crunch some data and appends it to a file during each iteration of the loop. They have placed this inside an event structure. There is a start button that when pressed triggers the event containing this loop. The program takes a fairly long time to execute each iteration of the loop (its using serial communication to transfer some data, crunch it and then append to the save file). If fed the wrong file this can take a long time to run to completion. Stopping it causes other issues with resetting the devices it is communicating with.

 

I need to add a stop button to terminate the event at the completion of the next iteration of the for loop. Is there any way to pass the 'button pressed' information into the for loop inside the event once it has already been triggered? I have very limited experience with the event structure other than making some basic programs to test it out.

 

Cheers,

Alex

 

If this description is insufficient to describe the problem I can post a modified version of the .vi showing the basic idea of what they've done and what I would like to achieve. I am unable to post the actual .vi due to NDA issues.

Alexander H. | Software Developer | CLAD

0 Kudos
Message 1 of 4
(2,723 Views)
Solution
Accepted by topic author alexhunt

you can right click your for loop and add a conditional terminal to it:

 

 

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 2 of 4
(2,722 Views)
Yes, this is what I would like to use but how do i get the button pressed information to the conditional? Is there a way to make the event case containing the for loop trigger to two different events?
Alexander H. | Software Developer | CLAD

0 Kudos
Message 3 of 4
(2,719 Views)

🙂 Thanks that worked perfectly once I sorted out how to add both events to the same case.

 

Cheers!

Alexander H. | Software Developer | CLAD

0 Kudos
Message 4 of 4
(2,711 Views)