LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to pause and resume the while loop?

Hi I remember seeing the sxample in the forum before the revamp of this forum. Now I cannot find any thread on pausing and resuming the loop.
How do I pause the while loop during the test and then resume it?
 
regards,
Clement
Message 1 of 10
(7,523 Views)

There are a bunch of different ways of accomplishing this. The exact method would depend on the structure of the rest of your code.  What exactly is it that you are trying to do?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 10
(7,507 Views)
Hi Mike
I's very simple. The test will continue after the start button is pressed, then the test is paused for further investigation and it is then resumed. All I ask how the structre looks like, maybe very basic so that I understand how it works and I improvised it based on the basic one. I cannot think how the paused loop works and resume the test from where it left.
 
Maybe your basic one will help me alot. Thanks
Clement
0 Kudos
Message 3 of 10
(7,506 Views)
If your while loop is structured as a state machine, you could just create a idle state that only contains a small wait. 😉
0 Kudos
Message 4 of 10
(7,501 Views)

So I can be sure I understand your requirement:

Operator presses button to start test.

At the end of the test the code "pauses" while some further investigation happens.

The start button is presses again to continue execution.

It sounds like all you really need is an event driven interface. Say you have a button called "Start Test". Create a value-change event for the button that includes your test code. Each time you press the button, the code will run the test and then go back to waiting for another event (button press).

If the button has to do something different when it "resumes", combine this basic structure with some simple state-machine techniques, and the code can cycle through a series of process steps each time you press the button. If you do this however, be sure to change the text in the button from "Start" to something like "Next", or "Continue" to keep the operator posted as to what's going on.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 10
(7,500 Views)
Hi. Mike and Altenbach
I am not sure if this attached  pauseloop.vi meets your advice. I can abort the loop.
I cannot use Pause and Start button to do paticular tasks.
 Pls see the attached. Hope that you will enlightenen me.
Thanks a million
 
Clement
0 Kudos
Message 6 of 10
(7,479 Views)
Sorry. Forgot my attached. It's version 7.0 I am using. So pls save it in this version. Thanks again
 
Clement
0 Kudos
Message 7 of 10
(7,476 Views)
Version 7.0 I am using. It looks tricky. "I" looks like "1"
I am using version 7.0.
0 Kudos
Message 8 of 10
(7,475 Views)

It's not the best method (this is quick and dirty), but you can put a small while loop inside your main execution loop.  Inside this new small while loop is a short wait (say 250 mS), and the pause button.  The button is wired to the while loop test condition.  So when execution enters the while loop and pause is true it is stuck there until the pause button is false.  If the pause button is false, it enters and exits the loop in one itteration.

Why it's bad: 

1) execution only pauses at this point of execution, not anywhere (not really a bad thing)

2) it's pretty yucky

3) your code waits the delay value even if it's not paused.

 

Why it's good:

1) you can add a pause to any looping VI in less than 30 seconds.  I'm guilty of using this a lot during testing and such. 

 

Sheldon

 

Technical geek, engineer, research scientist, biodegradable...
Message 9 of 10
(7,465 Views)
I once posted a pause solution with timer for hood1.  The timer would continue where it left off after pause.  If you don't need the timer, here is a simple pause solution in LV 7.0.  You can also do the same with an event structure.  Altenbach once posted that solution.  A bit more complex but it gives the solution if you are needing an event structure.  Ask if you want either the timer version or the event version.
- tbob

Inventor of the WORM Global
Message 10 of 10
(7,444 Views)