Jump to content

Real time elasped time


Kubo

Recommended Posts

Hello everyone,

I have a statemachine being used to run a sequence of steps that, when completed, will be about 40 minutes long. I am trying to figure out how to impliment a timer function that will act like a stop watch for this whole process. Right now I have it so that at the first step it will capture the current time then at the end it will take that captured time and delete from the new current time which in theory will display the elasped time it took to compete the whole process.

Could someone point me in the right direction that could get it so that this can display the time its taking in real time and not just display the time it took once its done.

Thanks in advance

Link to comment

I would create a parallel loop which contains your timer which is effectively a stop watch. This timer loop can be controlled by a queue so that you can pass in events such as start, stop or pause. When running this state machine will generally have one event queued which would be "update the display". When your master state machine is running you can pass the timer loop messages to start or stop your timer as well as pause or reset it. You can even package this up as a simple set of subVIs or a LVOOP object and give it a reference to your display indicator. If you do this you can reuse this in multiple applications.

Link to comment

QUOTE (Mark Yedinak @ Mar 20 2009, 04:38 PM)

I would create a parallel loop which contains your timer which is effectively a stop watch. This timer loop can be controlled by a queue so that you can pass in events such as start, stop or pause. When running this state machine will generally have one event queued which would be "update the display". When your master state machine is running you can pass the timer loop messages to start or stop your timer as well as pause or reset it. You can even package this up as a simple set of subVIs or a LVOOP object and give it a reference to your display indicator. If you do this you can reuse this in multiple applications.

Do you happen to have an example of a timer? Maybe a start, stop and reset function?

Link to comment

Do you dislike shift registers? :P

Instead of writing the start time to a local variable in your initialization case, instead write it to a shift register. Then every execution of the while loop (outside your case structure), subtract the shift register value from the current time and display that on your screen - voila, the elapsed time. Is that what you want? Maybe I misunderstood. You will need to do something with that elapsed time in your final case - maybe write it to total time indicator - because the elapsed time indicator will continue to increase after the sequence completes.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.