From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Timing a while loop

Hello. I have problems with timing a while loop. I used some examples of other people but its still not showing time. I am using flat sequence structure. My program is creating grayscale form webcam live video. I divided flat sequence structure to three parts, while loop was in second part and timers were in first and third. In third I substracted times like in second uploaded picture.

 

 

 

Download All
0 Kudos
Message 1 of 8
(2,702 Views)

The number you're feeding to the timer is the duration of the loop in milliseconds. If you pass that to a numeric indicator, you'll be able to see the value on the Front Panel. Is that what you're wanting to do?

 

Passing it to the "Timer" as you describe with the BD comments only makes you wait for that length of time, it doesn't display a value.


GCentral
0 Kudos
Message 2 of 8
(2,688 Views)

yes I want to create indicator showing how much time it needs to process image into grayscale and it should be changing because its real time image processing

0 Kudos
Message 3 of 8
(2,685 Views)

Hello Raew, 

 

Delete the Wait for ms Timer you have in the last panel of your sequence structure, then right click the left over wire and select Create Indicator.   This will give you the elapsed time in milliseconds. 

 

 

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 4 of 8
(2,678 Views)

I have it like this and it is not working.

0 Kudos
Message 5 of 8
(2,675 Views)

If you are looking for the time for each iteration of your loop, you need to put the timing checks inside of your loop.  Use a Feedback Node to hold the previous iteration's time and subtract the current from the previous.


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
0 Kudos
Message 6 of 8
(2,669 Views)

yes I need to know how much time does program need for transformation of image. I inserted it into loop so it should now  show correctly time in seconds right?

0 Kudos
Message 7 of 8
(2,664 Views)

@raew wrote:

yes I need to know how much time does program need for transformation of image. I inserted it into loop so it should now  show correctly time in seconds right?


No.  It will tell you how much time elapsed since the last time you saved the Clock.  This includes everything that happens inside the loop, including (a) acquiring the Image and (b) transforming the Image.  If you want to know only (b), you need to make two Time measurements -- one just before you enter the Case Statement and one right after you exit the Case.  The Timer doesn't have an Error Line to "anchor" it sequentially to anything, so this is one of those rare instances where a Sequence structure, with three Frames, is useful.  Put the Case Statement in the middle Frame, a Precision Timer in the first and third, and subtract them.  The First Frame (with the "Start" time) won't be executed until just before the Case, and the Third Frame (with the "End" time) won't be executed until just after the Case, precisely what you need.

 

Bob Schor

0 Kudos
Message 8 of 8
(2,661 Views)