From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

accumulated timer with multiple starts and stops

Solved!
Go to solution

I Know this is probably a duh moment, but I need to create a timer that when an I/O state goes true keeps track of seconds and when the I/O state goes false stops the timer but keeps the seconds and adds it the new seconds when the timer starts again.

 

So this is an accumulated timer with multiple starts and stops (In ladder logic I would just use an accumulated timer, turn it on and off).

 

I like the idea of using the “Elapsed time” but I need some way to store the seconds and not be reset to zero when the timer stops. Ive tried “loop back nodes” but need some way to isolate it so it doesn't see the reset zero. Or maybe theirs a better way. The solution just keeps hiding from me.

 

I have multiple NI 9421’s talking via eNet to LabView 2010 on Windows7, reading boolean states with single channel lines from DAQ Assist. 24 cnc machines, reading 4 different on/off states each. I want to know how long each machine has been on and/or off in each state, accumulative.

 

Eventually displaying on a monitor each state like a semaphore, and recording to a file for future use, but I think I have that part worked out. Any help would greatly be appreciated.

0 Kudos
Message 1 of 2
(2,345 Views)
Solution
Accepted by topic author dchris22

A shift register and a case structure are the keys to accumulating things conditionally.

 

The example attached accumulates counts rather than time. It adds to the count when the random value is greater than 0.8.  For time accumulation I would either use Tick Count or Get Current Date/Time and subtract the current value from the previous value. Add the differenc to the cumulative total.

 

Lynn

Message 2 of 2
(2,327 Views)