Timer : Measuring Elapsed Time
Here you can find a FGV timer implemented using the function ‘Get Date/Time in Seconds’ to measure elapsed time.
What is a Functional Global Variable(FGV)?
A Functional Global Variable is a VI that uses loops with uninitialized shift registers to hold global data. Shift registers keep track of past information. So a FGV uses a For or While loop to hold data until the VI remains in memory. It usually consists of an action input parameter which specifies the task to performed by the VI. Every time this VI is called, it will run only once(notice conditional terminal of the while loop being connected to TRUE).
Here ‘Timer States’ enum specifies the action to be performed by the VI. There are two actions:
1. Start Timer: In this case the timer is reset. Since the timer is started now, the current time is obtained and assigned to shift register as Start time. Time target is also assigned to the shift register. Here time target is the time we are waiting to get elapsed.
2. Elapsed Time: In this case the elapsed time is measured. Every time this case runs, current time is obtained and the start time which was previously stored in the shift register is subtracted from the current time to obtain the time elapsed since the timer was started. If the elapsed time is grater than or equal to the time target, then the Elapsed? LED boolean becomes TRUE.
Below, the time target value stored in the shift register is used for comparison. Refer to comment
Check this post for timer with pause and resume functionality.