Orange County LabVIEW Community

cancel
Showing results for 
Search instead for 
Did you mean: 

CLD: How to make a Pausable Timer using the Elapsed Time Express VI

In the CLD preparation materials, one of the things it's recommended that you know how to do for the test is to be able to pause a timed execution cycle. For example, the Car Wash sample program requires you to pause the various wash cycles if the vehicle position switches open. In years past, the Elapsed Time VI had the ability to pause the timer, but strangely, the current Elapsed Time Express VI does not. Since it's not intuitively obvious (to me anyway) how to do this if you've never done it before, I created this VI to demonstrate the most simple case of how to pause a timer and show not only when it has elapsed, but how much time has gone by since it was started.   It works by keeping track of two variables on a register. The first is the Recirculation Time (the time stamp for the prior call of the function) and the second is the Start Time for the timer. Subtracting the Recirculation Time from the current time tells us how much time has passed since the last call to the function. If the timer is paused, we add this to the Start Time and reinitialize the Elapsed Time VI. This has the effect of moving the Start Time forward by however much time has passed every time the loop iterates for as long as the timer is paused, so it never reaches it's elapsed time target. Once the timer us unpaused, the Start Time stops updating and the timer continues to count. The last thing that must be taken into account is what happens when the Elapsed Time is reached. Once that happens, the Start Time must be updated to the current time for the next use of the timer.  Since knowing how to do this ahead of time will shave time off when taking the CLD, and since a number of people will be taking the test in December, I thought it would be good to post this for people to look at.  The VI is in LabVIEW 8.5 format, I hope it helps!  Jim Smith
0 Kudos
Message 1 of 6
(19,687 Views)

Thank you, thank you!

I have to make myself familiar with this. Strangely, in my 11 years with LabVIEW, so far, none of the applications I worked on required pausing a timer. This will certainly help a lot of people to prepare for the CLD.

Scientia est potentia!
0 Kudos
Message 2 of 6
(6,117 Views)

I'm glad it helps, Magyar. The Elapsed Time Express VI does not always work the way you would expect, and while the help screen for it is informative, it doesn't cover a number of important details. To make this work, I had to look at the underlying code of the Elapsed Time VI to determine the best implementation. I also have a version of it that can act as a stand-alone substitute for the Elapsed Time VI, but I posted this one because it's less complex and easier to see how it would fit within the context of a state machine.

0 Kudos
Message 3 of 6
(6,119 Views)

Keep it simple. This is how I did it for my test. Keep things simple.

Dan

Message 4 of 6
(6,119 Views)

This pausible timer fits for my application. Thanks a lot for sharing.

0 Kudos
Message 5 of 6
(6,119 Views)

hi,

can i use the time express vi in cld exam ?

0 Kudos
Message 6 of 6
(46 Views)