Example Code

Generic Timer module with Pause and Resume.

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.


  • LabVIEW

Code and Documents



A generic timer module (subVI) that tracks target time and sets up a boolean "Expired" if the elapsed time is greater than target time. The timer also allows pause and resume features.



This VI uses a shift registers to hold timer state, target time, elapsed time and  time stamp of last action. These registers retain values as long as LabVIEW is running in background.To use this VI effectively, set the command enumerator option "Set Timer" and place the target time in "Timer Set Value(Seconds)". Commands Check timer can then be executed as many times as required to check if the elapsed time has passed target time value. The output boolean "Expired" is set true if the timer has expired. The timer can be paused anytime before the timer expires and the VI will pause the timer and wait for the resume timer. Once resumed, the timer will start from where it was paused until it reaches the expired state.



  • LabVIEW 2012 (or compatible) 


Steps to Implement or Execute Code

  1. Run the VI
  2. Set, Pause and Resume the timer in seconds by clicking on buttons on Front Panel.


Additional Information or References


The Context Help for the Timer Utility



VI Snippet of Timer module




The Front Panel of the Timer Test VI lets you Set, Pause and Resume the timer in seconds.



 VI Snippet of Timer Test VI





**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.


Thanks for the well written code.


thanks for your code