LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

controlling Buttons

in the following VI, i am facing one problem. when in control panel i set a time for 60 seconds.and during execution i make a pause, when i resume the execution, the VI must resume the from the moment i make pause. this is not the happening and the VI resumes from the current time. why? please explain me. thanks
0 Kudos
Message 11 of 44
(1,153 Views)
Your vi's look ok. They should function as you expect. The only thing that I would add would be a small delay inside the main while loop. Perhaps 100 milliseconds. This gives time for the cpu to perform other operations. Without a delay, your vi is hogging all the cpu time.
- tbob

Inventor of the WORM Global
0 Kudos
Message 12 of 44
(1,153 Views)
Even though you are pausing your loop execution, your PC clock is still running. The function to get the time in seconds will always return the current time. If you pause for 10 seconds, when you resume you will the read the current time, 10 seconds after the pause. I don't understand what is the problem. If you are looking for some type of loop counter, use the iteration icon, i. It will continue with the next number after the pause was made.
- tbob

Inventor of the WORM Global
0 Kudos
Message 13 of 44
(1,153 Views)
thanks for your reply. well as you know, i set a control for time. in present case, if i want to execute my application for 100 seconds without any break,it will work fine.there is no problem at all.
but now the other side, if just 10 seconds after start of execution if i pause for 60 seconds and resume again, it will run only for rest 30 seconds or if i resume after 90 seconds of pause , then it will not run at all. now what i am looking for is to resume
at the point where i make pause and run further 90 seconds in order to finish 100 seconds given time.
you mention iteration icon. what do you mean by that?
thanks
regards
0 Kudos
Message 14 of 44
(1,153 Views)
Iteration icon is the little "i" that is inside the loop at the lower left corner. It tells how many times the loop has run.
You need to have some sort of timer for your loop. Read the starting time before the loop as you do and store it in a start time variable. When you pause, read the time again and subtract the start time to get the time that the loop was running. Store this time in a time elapsed variable. When continue is pressed read the time again and store it in start time variable. Every time you pause, you have to add the elapsed times. Upon exiting the loop, calculate elapsed time again and add it to overall elapsed time.
- tbob

Inventor of the WORM Global
0 Kudos
Message 15 of 44
(1,153 Views)
yes i tried it, but it did not work. i dont know what is wrong. i am sending you the updated VI. please show me the example.
Thanks
0 Kudos
Message 16 of 44
(1,152 Views)
You did not exactly follow my suggestion. Inside your True case when the break button is pressed, this is where you have to read the current time and calculate the elapsed time. Add it to the previous value for elapsed time. Your waiting for the continue button loop then executes. When the continue button is pressed, you exit out of that loop and take another start time reading to use later. Look at the attached example. You could use shift registers instead of local variables, but this makes it more readable.
- tbob

Inventor of the WORM Global
0 Kudos
Message 17 of 44
(1,152 Views)
thanks.
well i make some alteration according to your suggestion, but nut fully clear .i am sending you the VI.
you said an example is attached.i did not got it.
well please send me an example.
regards and thanks
0 Kudos
Message 18 of 44
(1,152 Views)
Sorry, here is the attachment.
- tbob

Inventor of the WORM Global
0 Kudos
Message 19 of 44
(1,152 Views)
i am sorry but once again. but in your example you did not mention where should i can say that i want to run the program for example for 2 hours and if i reached this limit. it must stop. which place in your prgram i can say to the program please run 30 minutes and if you reach 30 minutes then stop and please dont add any pause time in your exution period. please give me a complete reply.
thanks
0 Kudos
Message 20 of 44
(1,152 Views)