03-21-2013 02:47 PM
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
03-21-2013 02:54 PM - edited 03-21-2013 02:54 PM
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.
03-21-2013 02:57 PM
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.
03-22-2013 06:24 AM
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.
03-22-2013 10:51 AM
@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!