To download NI software, including the products shown below, visit ni.com/downloads.
Overview
Demonstrates how to use loop iteration time to roughly measure the amount of time a Boolean has been ON for
Description
DISCLAIMER: Since this is being run on Windows, which is not a deterministic operating system, it is prone to jitter and there is therefore no guarantee that the loop iteration time will be exactly the same on every iteration (it could exceed 5ms on any given iteration due to lag created by background processing). As a result this is not an extremely accurate means of measuring the time the signal has been on for. It would not be good for applications such as alarms or system shutdown conditions. However it is appropriate if you just want to know how long a signal has been on for and do not need accuracy on the ms scale.
This VI uses a shift register to increment a value while the Boolean is turned ON. The minimum loop iteration time of 5ms is then used to convert this value to the approximate amount of time that has elapsed since the Boolean was turned ON.
Requirements
Steps to Implement or Execute Code
Additional Information or References
VI Snippet
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.