LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing a while loop with tick count

Hi!

I'm having some trouble timing a while loop using the tick count function. I have attached a photo of my code. The loop acquires an image from a camera, writes the image to file and then times the loop. I add the value of the tick counter to a queue as I guessed this might be the quickest way, I'm hoping the timing feature won't effect the loop. Later I write the values to a matrix and plot them. Besides the fact that the loop apparently takes a different time to complete each iteration my major problem is that the acquisition time for the camera is set to 1s but tick count is suggesting the loop only takes 8-40ms to complete! 

 

If anyone has any idea why this is happening or a better idea of how to time the loop I'd be very grateful.

 

Many thanks,

Ciara

0 Kudos
Message 1 of 5
(4,267 Views)

There is no way to tell from the picture. What is in the other frames of the sequence? Please attach the actual VI!

 

Why are you using a local variable instead of a simple wire for the start time? At least the first iteration will have a random time, because there is no way to tell if the loop start after or before the start time is written.

 

Suggestion: get rid of the stacked sequence and use a shift regsiter for the "acquired" value.

0 Kudos
Message 2 of 5
(4,255 Views)

To add to Altenbach's comments, you can likely use the error cluster and data flow to sequence your code.  It is very likely the sequence structure isn't needed at all.  I see plenty of local variables that could easily be replaced with wires.


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 3 of 5
(4,249 Views)

Hi, thanks for tips. Still had trouble even with shift registers but have changed to just recording the timing value for each loop and then finding the differences in excel after which gives me sensible results.

0 Kudos
Message 4 of 5
(4,218 Views)

@Ciara33 wrote:

Hi, thanks for tips. Still had trouble even with shift registers but have changed to just recording the timing value for each loop and then finding the differences in excel after which gives me sensible results.


That is just silly and not a solution in general. Let's find out what the real problem is instead!

0 Kudos
Message 5 of 5
(4,194 Views)