Example Code

How to time a step in your program in LabVIEW

Code and Documents

Attachment

Overview:

This VI exemplifies how to is create basic timer that measures how long a button has been pushed on.
Description:

This can be useful if you have a program that is designed to perform a certain test when the user clicks a button. It allows you to measure how long this test took and it latches the last value. When the VI is in ideal state, the Start Time shift register is update it with the current time. This is useful to have a reference of the start time when the button was pressed. When the user pushes the button, the "active" state finds the difference between start time and the current time using the Get Date/Time in Seconds VI. Then it puts that time difference into the Elapsed Time shift register. When the user pushes the button again to switch back to the idle state, the current Elapsed Time will be saved in this shift register.
Requirements:
LabVIEW Base Development System.
Steps to Implement or Execute Code:
1. Open the attached VI named “Timer for Pushed Button LV 2012 - NI Verified.vi”.
2. Run the VI.
3. Push the boolean control named Switch.
4. Read the value of the Elapsed Time indicator.
Additional Information or References: 
Snippet 8421.png**This document has been updated to meet the current required format for the NI Code Exchange.**

 

 

Jared S.
Applications Engineering
National Instruments

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