Pause and continue the time with Elapsed time.vi in LabVIEW

Sunday, July 31st, 2011

Elapsed Time.vi is a very useful Express vi which returns the elapsed time and can be reseted. Unfortunately there is no pause function in Elapsed Time.vi ( LabVIEW 8.5 to 2009). I had been looking for the examples of pausing and continuing the time in LabVIEW, but there seems not be a simple one.
So I created this myself. It is not efficient in term of excecution time, but it is simple to be made from scratch and memorized.

Basically the shift registers are used to store the previous elapsed time. When it is in the false (run) case, the elapsed time is added to the ‘total elapsed time’. When the vi in the true (pause) case, the total elapsed time is transferred to the start time and the Elapsed Time.vi is reseted (stopped). Hope this will be helpful. 🙂

 

———————–In response to Mark’s question——————————–

So I added the reset function for this SubVI:

When you reset the clock, you simply ‘reset’ it and send ‘0’ to elapsed time. Hope it helps.

Advertisements

7 comments on “Pause and continue the time with Elapsed time.vi in LabVIEW

  1. Mark Anderson says:

    This is great, how would you make it so that it could accept an input that would reset the elapsed time to 0?

  2. […] pause/resume/restart your state machine. I made a subVI beforehand to practise it. You can find it here. 3. Pay attention to the documentation, which should be the easiest part to get the credits. 4. If […]

  3. This is a great code bit to use in the CLD exam.

    One comment: With the updated code, the “Time has Elapsed” boolean indicator will show true only if the set time has elapsed since you have unpaused the VI (since the pause also resets the express VI). No big deal, a small bit of comparison code can create that output easily. Just don’t use this indicator as the gate for the next step of your code in your CLD exam as it is coded here, 😀

  4. […] Here are what I have learned from the examples, and I will add more thoughts as the practice goes on. Hope this can be helpful: 1. We do not need to install any module beside LabVIEW to take the exam. It tests your coding ability instead of your module experience. 2. The logic of the exam is very complicated. 3. For me, the exam could be finished if more time (maybe 2 more hours) was given. Thus the challenge is how to finish it in the limited time. You cannot do that without good practice. 4. Use state machine, as stated in the exam. And I found the queue operation is not necessary in these 4 exam samples. 5. The project manager is not neccessary for there won’t be many versions of your code. 6. Folders named “SubVI” and “Control” are useful. Put the Top_level.vi in the top folder. 7. There could be file read/write operation, and thus we need to master how to manipulate the file path and text-related functions. 8. Draw the states clearly before coding, which saves you a lot of time later (Or, do not code before the logic of states is clear). 9. Because of 8, pens of different colours are very helpful (but is it allowed to bring our own pens?). 10. Set the preference of block diagram a ‘comfortable’ way. E.g. untick Display terminals as icons; untick Show dots at joints; untick Auto wiring; tick Default SubVI terminal as required. 11. Quick drop saves you time. 12. Save the code frequently in case of unknown situations. 13. If you cannot finish the code, create all SubVIs only with front panels. At least the program could be ran (with some missing functions). 14. Knowledge of timed loop and control reference are necessary (Update: I added an example in this post). […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: