LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Pause/continue a loop in Labview

Hi,
 
In my front panel menu, I am having two options 'Run' and 'Pause'. 'Run' starts executing of the selected test cases from a list box .The user can pause the execution by pressing  the 'Pause' option at any time. When the user press 'Pause' I need to pause the execution of test cases until the user press it once again.  On pressing Pause again, the test case execution should continue from the point at which it was paused.

Can u tell me how to implement this using event structures?? I tried doing it but once I press Run, it executes the complete state for Run before responding to the Pause event.
 
Regards

Siddharth

0 Kudos
Message 1 of 33
(13,309 Views)

Hi Siddharth,

if you want to do it with the event structure, insert all your code which runs your sequence into the timeout case. Create a shift register with "-1" connected to initialize it and connect it to the "event timeout". Create an event case for your "run" and "pause" button. In the "run" button event case, set the value of your shift register to a value greater than "-1" and in the "pause" button case to "-1".

Mike

Message 2 of 33
(13,283 Views)
To elaborate on Mike's idea...
- Partha (CLD until Oct 2021 Smiley Happy)
0 Kudos
Message 3 of 33
(13,265 Views)
How dose your Programe structure looks like? do you use queue to start and end your process?
0 Kudos
Message 4 of 33
(13,259 Views)

Hai,

Hope this is your requirement. I had just changed some names in Front Panel.

Thanks,

Mathan.

Message 5 of 33
(13,254 Views)

@Mathan wrote:

Hai,

Hope this is your requirement. I had just changed some names in Front Panel.



And have managed to create a VI that doesn't work. Smiley Surprised Did you actually run it and debug it? What is the point of the extra "Run" button?
0 Kudos
Message 6 of 33
(13,223 Views)

 

 

hi , 

 

I want a similar programme which can be execute as following :

 

Running continously until i press the pause button then pause and i press the same button it continue run until i press pause again ....

 

I am awaiting for your reply , 

 

0 Kudos
Message 7 of 33
(10,790 Views)
Highlighted

@MikeS81 wrote:
 

Hi Siddharth,

if you want to do it with the event structure, insert all your code which runs your sequence into the timeout case. Create a shift register with "-1" connected to initialize it and connect it to the "event timeout". Create an event case for your "run" and "pause" button. In the "run" button event case, set the value of your shift register to a value greater than "-1" and in the "pause" button case to "-1".

Mike


You have to be careful with this approach. If your code takes a while to exeute your application will become unresponsive since it can't service any other events until the code in the timeout event completes. You might be better of with a producer/consumer architecture with a state machine in the consumer.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 8 of 33
(10,778 Views)

You could download & use the same VI, modifynig as per your requirement.

- Partha (CLD until Oct 2021 Smiley Happy)
0 Kudos
Message 9 of 33
(10,771 Views)

Hi, would you happen to have VI in version 8.2. I tried it does not work.

Rulee
0 Kudos
Message 10 of 33
(9,954 Views)