Example Code

LabVIEW Multiple Independent Timers with Non-Reentrant Sub VI's

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: This example shows how to measure the elapsed time in separate calls of a non-reentrant subVI. You cannot use the Elapsed Time Express VI that ships with LabVIEW to accomplish this task because resetting the VI from one call of the non-reentrant subVI resets the timing in all of the subVI calls.


Description: This VI shows how to properly create multiple independant timers. Notice that you cannot use the Elapsed time VI as that shares a common reset line and will reset all instances of the VI.

This example stores multiple start times in an array of indexed timers so that you can measure the elapsed time in each separate call of a non-reentrant subVI. The example includes the Multiple Elapsed Times VI that performs the elapsed timing function. The example also includes a VI that calls Multiple Elapsed Times.vi and shows how to use this VI in non-reentrant subVIs. Multiple Independent Timers.vi is the main VI.


Requirements: LabVIEW 2012 (or compatible). Hardware: none.


Steps to Implement or Execute Code: Run the VI, use controls to manage timers, follow the indicators on elapsed timers.


Additional Information or References:

 

LabVIEW Multiple Independent Timers with Non-Reentrant Sub VI's FP.png

 

LabVIEW Multiple Independent Timers with Non-Reentrant Sub VI's sn.png


**This document has been updated to meet the current required format for the NI Code Exchange.**

 

Sincerely,
Jason Daming
Applications Engineer
National Instruments
http://www.ni.com/support

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

Comments
Lily1979
Active Participant
Active Participant
on

hello,

How to add a button pause for this?

Thanks.

Lily