09-03-2014 11:09 AM
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!
Solved! Go to Solution.
09-03-2014 11:40 AM
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…
09-03-2014 11:50 AM
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.
09-03-2014 11:53 AM
09-03-2014 12:01 PM - edited 09-03-2014 12:03 PM
Why not use the Elapsed Time Express vi? (turn off auto reset)
09-03-2014 12:24 PM
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 Naicha
09-03-2014 12:29 PM
@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.
09-03-2014 12:54 PM
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.
09-03-2014 01:11 PM
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.
09-03-2014 01:20 PM
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