LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting a counter to relative time

Solved!
Go to solution
Hello!  I have a fairly simple question if anyone has a moment.  I have a while loop with a 1000ms Wait inside, along with some other stuff that's irrelevant to the question.  Since my incrementer essentially counts the seconds elapsed due to the presence of the 1000ms Wait, I'd like to take the built in incrementer (i) and use it to display the relative time that has elapsed since the while loop began.  This loop will be running for 3 hours, so I'd like to display in HH:MM:SS format.  So basically, I'm looking for a way to convert the counter into a time value.  Any thoughts?  I know the Wait function isn't exactly accurate, but that's ok.  I don't need to be 100% accurate in this vi.  Just a rough estimate will be fine. It seems like there should be a relatively simple way to do this, but I can't figure it out...  Thanks!!
0 Kudos
Message 1 of 6
(3,070 Views)

The code could not get much simpler. You just wire a numeric indicator to the iteration terminal. Set the display format to absolute time and HH:MM:SS time format.

 

Message Edited by Dennis Knutson on 02-04-2009 09:00 AM
0 Kudos
Message 2 of 6
(3,067 Views)
I did that, only to have my elapsed time indicator display 07:00:12, and then start counting backwards in a non-linear sequence.  I didn't understand it...  Thoughts?
0 Kudos
Message 3 of 6
(3,054 Views)
Solution
Accepted by McMurray
Well, I just noticed a difference between 8.5 and 8.6. With 8.6, I had to set the display format to relative time. Other than that, I don't know what would cause it to run backwards. Post your code.
0 Kudos
Message 4 of 6
(3,050 Views)

That got it to work.  You also need to select "adapt to source" as your data type, then it stops doing the weird 07:00:12 thing.  Thanks for the help!

 

Matt

0 Kudos
Message 5 of 6
(3,030 Views)

By the way, if you want the time to be more accurate (depending on how much other stuff you are doing in the loop) you may want to use the

"Wait Until Next ms Multiple" vi instead.

0 Kudos
Message 6 of 6
(3,026 Views)