LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop a elapse time

Hi,

I have an elapsed time inside a while loop and I want stop it (the elapsed time) when the user press a button.

How can I do it?


Thanks,

ToNi.
Message 1 of 19
(4,871 Views)
Hi tonitpp,

We work much better when we have visual aides.

Would you mind posting the code or an example of the code you have and we will advise on how to proceed.

We can also work from jpg's etc, No BMP's please.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 19
(4,864 Views)
If you're talking about an Elapsed Time Express VI, you can't stop it because it doesn't loop.
It only runs once in each iteration of the loop to see if the time has passed.
If you want to stop using it altogether, you can simply place it in case structure wired to your button.
BTW, you can see the code for an express VI by right clicking it and selecting Open Front Panel and then Convert.

___________________
Try to take over the world!
0 Kudos
Message 3 of 19
(4,853 Views)
Hi,

I don't have any code or an example yet because I don't know how to do it. Now, I am thinking about what is the best way to wait a lot of time inside a loop while and permits the user to stop it (and continus the next iteration) when he wants without waiting the initial time I have setted is elapsed.

How can I do it? Some idea? If I can't stop a elapsed time express when I want....

Thanks,

ToNi.
0 Kudos
Message 4 of 19
(4,835 Views)
You can't. The wait function will wait its full time before returning.

The Elapsed Time VI, like I said earlier, doesn't wait. It just checks each time you run it whether the time has elapsed since it was reset.

What you can do is have another while loop inside your while loop, and it will decide when it's time to finish the iteration by using elapsed time or your user input.

___________________
Try to take over the world!
Message 5 of 19
(4,834 Views)
Hi tst,

Your idea is very very good but.... I don't want the elapsed time vi continues the while loop for the next iteration because it consumes time of cpu (I need a good performance). I would like the elapsed time waits some time (without passing to the next iteration of the while loop) and then... when I press a button it stops waiting and continues for the next iteration of the while loop. I know the elapsed time vi doesn't wait... then I need a method that waits and it continues for the next iteration when I press the button, is there another way? another block like the elapsed time but with the possibility to do what I want: I want a block that waits for a lot of time and not continues the next iteration, and continues with the next iteration of the while loop when the user press the button I want. How can I do it? Which another block (no elapsed time express)?

Thanks,

ToNi.
0 Kudos
Message 6 of 19
(4,824 Views)
If you're that concerned about CPU consumption there are 2 things you can do.
First, if only want this to happen when a user clicks a button, then what you want is the event structure. You can configure an event for the button and the structure will wait until that event occurs. There are some event structure tutorials around, try searching the site and the user manual.
If this isn't good, you can save the express VI as a regular VI. This should reduce the amount of CPU power it takes. Then, decide on your maximum length of time you can wait before reacting (10 ms, 100 ms and so on) and set that as the waiting time for the inner while loop.

___________________
Try to take over the world!
0 Kudos
Message 7 of 19
(4,817 Views)
Hi,

Thanks for helping me but I think I don't explain to you well what I want to do. Now I try to explain it well again.

I have a while loop, and inside it and elapsed time vi or another block (like a wait (ms) block or wait until next ms multiple with possibilty to force stop waiting when the user press the button) that waits a lot of time and not continues executing the while loop until the user, from another vi, press a button. When the user, from another vi, press a button, the while loop of the another vi continues with the next iteration. How can i do it? Which block is the appropiate for doing it (because I can't do it with an elapsed time vi)?

Thanks,

Sorry for not explain my problem well at the beginning.

ToNi.
0 Kudos
Message 8 of 19
(4,808 Views)
Here is a vi that I created for demonstration of how to keep track of running time with the ability to pause and continue by pressing a switch. Perhaps you will find it useful and can modify it, or use some of the code in your vi. If you want to control the pause and continue from another vi, you will have to pass the reference of the pause switch to this vi, and change this vi to use the reference instead of an actual pause switch. Hope this helps.
- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 19
(4,803 Views)
Hi,

I can't open it.

Can you attach it in LV7 Express format?

Thanks,

ToNi.
0 Kudos
Message 10 of 19
(4,796 Views)