LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Elapsed Timer in secs

Solved!
Go to solution

Hello,

 

I would like to continuously update the elapsed timer indicator every second.  I do not understand why the program is not working?  Can you offer some assistance to help me display the elaspsed time (in seconds).  

 

Thanks,

hiNi.

 

P.S. I know that there is an elapsed timer express VI, but I would like to know how to show the elapsed time without the express VI. THANKS!

0 Kudos
Message 1 of 13
(3,066 Views)

Hi HiNI,

 

you need to initialize the shift registers at first call. There's a function named "First Call?" that will help you to do so…

 

Why do you need to add periods of time? Why not simply store the start time and subtract it from current time?

 

Do you know you can look what the ExpressVIs do under the hood? Just open their front panel…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 13
(3,054 Views)

You need to be a bit more specific on what is not working for you.  There is nothing controlling the execution speed of the loop so it will run as fast as the copmputer will allow.

 

Is this part of a larger application or you just want to watch a number increment every second?

 

 

As a general suggestion, do not use a shift register on the error wire.  In this example, if an error is generated it is still going to loop.  Run a wire off the error wire and into an unbundle by name to get the status field and feed that into an Or with the stop button to end the loop.

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 3 of 13
(3,051 Views)

Hi Doug,

 

since some years you can wire an error cluster directly to boolean functions, thus no need for Unbundle(ByName)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 13
(3,045 Views)

Why not use the Elapsed Time Express vi? (turn off auto reset)

time.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 13
(3,038 Views)

Hi, hiNi,

I think I kind of understand what you aretrying to do. I think the "initial get time" should come from "main.vi" instead of "sub.vi" so that you capture the start time only once at the beginning of main.vi loop.  Also, in side your subvi I suggest you just use the subtract function.

 

Pudding Naichasubvi.JPG

0 Kudos
Message 6 of 13
(3,023 Views)

@GerdW wrote:

Hi Doug,

 

since some years you can wire an error cluster directly to boolean functions, thus no need for Unbundle(ByName)…


Was not aware of that.  Good to know.

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 7 of 13
(3,021 Views)

Hello,

 

I am trying to show the Elapsed Time output updated every second.  I have tried to simplify my overall VI to just three cases.  Each case will take a different amount of time to execute.  I would like to however keep a running timer (in seconds) as the program progresses.

 

I am still having problems updating the timer every second (see attached file).  The Elapsed Time output does not update every second correctly.  How can I output a reading every second as the program progresses?

 

Thanks,

hiNi.

0 Kudos
Message 8 of 13
(3,005 Views)
Solution
Accepted by topic author hiNI

Why every second?  Why not with each iteration of your loop?

 

Since your loop iterates every 100ms, you could make a counter using another shift register.  When the counter reaches 10, get your elaspsed time.

 

Give these VIs a try to see if they do what you want.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 13
(2,994 Views)

Hi,

I think the shift register you have inside the sub.vi does not necessarily hold the last value you have in there everytime you call it.  Two possibilities:

1. Everytime you leave the sub.vi and go back to main.vi,"first call" think you are call the the sub.vi for the first time again

2. Or shift register(for time elapsed) gets reinitialized every time you leave the sub.vi.

so every other value is not correct.  If you want to increment or keep any value in a variable they should probably be in "main".

 

Naicha

 

 

0 Kudos
Message 10 of 13
(2,984 Views)