Showing results for 
Search instead for 
Did you mean: 

Creating timer with a 'paused' timer as well.


I am looking to create a timer that will count down from a specific value (ex. 15 secs). When the timer is paused, a separate timer will start and record how long the initial timer is paused for. This value would then be added to the count down value (the 15 secs.). The pausing can happen multiple times per cycle.  I have attached my timer VI without any paused timer as nothing is working for me. Any tips would help. Thanks



0 Kudos
Message 1 of 5

Can you explain the pausing feature you want to implement in other words? The way you described it sounds like you could do the following:


Start Timer

Wait 5s (Timer reads 10s)


Wait 30s

Resume (Timer reads 40s)

Wait 40s


0 Kudos
Message 2 of 5

I would recommend a few more LabVIEW tutorials, because the code is extremely convoluted. (For example there is no need for the inner while loop (you can anchor the shift registers on the outer loop!) and you probably also should have a small wait somewhere to prevent the VI to consume all CPU, spinning millions of time per second.


You cannot really "pause" the express VI, so make your own. All you probably need is a simple state machine. Look into it.

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 3 of 5

Gregory, your example described its exactly what I am trying to accomplish. The only thing I may add is that the system can be paused multiple times and can be paused for any length of time. 



0 Kudos
Message 4 of 5

As altenbach described, what you need is a State Machine.


One possible solution might use a set of cases like {Idle, Reached Zero, Counting Down, Counting Up, Stop} and transition into the Counting Down case from Idle when you start the timer.

If the Pause button becomes active, transition to Counting Up.

When it becomes inactive, go back to Counting Down.

Add or Subtract the loop time (choose a sensible increment and place a Wait (ms) node, for example) each iteration of Counting {Up,Down}.

If you are Counting Down and remaining time = 0, then go to Reached Zero state, and pop a dialog box, or an LED, or whatever you require, and then go to the Idle state.

If (from any state) your "stop" button becomes true/active, then go to the Stop case and ignore whatever you were doing and end the VI.


If you aren't already familiar with this, reading about the mechanical actions for buttons might (will) be useful.

Message 5 of 5