Jump to content

Timer with Pause via Functional Global


Recommended Posts

Hey guys,

I'm prepping for the CLD in a couple weeks and running through the sample exams to brush up on my techniques since I haven't been doing LV actively for almost a year. One thing that I know is crucial to the CLD is proper timing. I'd run through the exams a couple years ago but never followed through with the official exam, and during the course of completing these I'd come up with a really nice, elegantly simple timer with pause that was implemented via a functional global. Trouble is, I can't seem to find my code anywhere and for some reason the logic to complete this is elusive at the moment. Have a look at my code - you'll see that I have a normal Get Date/Time in Seconds timing method, I'm just having trouble remembering what I did to implement the pause case. Anyone have any suggestions? Maybe it's just Friday and my brain has already checked out for the weekend...

I know it was *something* like what I've attached, but more complicated. I'm pretty sure I'm missing something insanely simple... maybe a shift register tracking the states to determine when the pause case is first entered?

- Ben

Link to comment

Hi Ben,

I am preparing for my CLD as well. I am going to take it this friday at AL. I ran into the same problem as well. I guess you were working on the car wash example. I attached my take on the timer with pause, since the timer in the car wash example is too complicated. I added a few more states. Here is a usual call sequence of the function globel when you use it: start timer -> check timer -> pause timer -> restart timer -> check timer. This is not the most eligant solution, but it should do.

Link to comment

QUOTE (jyang72211 @ Mar 3 2009, 01:12 AM)

Hi Ben,

I am preparing for my CLD as well. I am going to take it this friday at AL. I ran into the same problem as well. I guess you were working on the car wash example. I attached my take on the timer with pause, since the timer in the car wash example is too complicated. I added a few more states. Here is a usual call sequence of the function globel when you use it: start timer -> check timer -> pause timer -> restart timer -> check timer. This is not the most eligant solution, but it should do.

Thanks for the example, although I think I've finally nailed it! I think I have some redundant wires in there, but it's simply for showing the exact elapsed time when the timer is paused. I think this is a pretty nice solution that allows for fairly accurate software timing and that's a pretty handy thing to have for the CLD. Any comments or critiques would be greatly appreciated!

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.