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.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

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.

 

Description

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.

 

Requirements:

  • 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

timerVI.PNG

 

VI Snippet of Timer module

Timer.png

 

 

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

timerExampleVI.PNG

 

 VI Snippet of Timer Test VI

2.png

 

 

 

**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.

Comments
lewboi
Member
Member
on

Thanks for the well written code.

leon1129
Member
Member
on

thanks for your code