LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing inside of a timed loop

I am having some difficulty with timing inside of a timed loop. Inside of a timed loop with a 1000ms period, is there a way to change a T/F signal at varying amounts of time after the beginning of the first iteration of the timed loop. For example, if the timed loop is stopped after 60 seconds (60 one second iterations), how do I time and change a boolean at say 1 second, 2.5 seconds or 3.05 seconds without slowing the process of the timed loop?
0 Kudos
Message 1 of 6
(3,486 Views)


@Conor wrote:
I am having some difficulty with timing inside of a timed loop. Inside of a timed loop with a 1000ms period, is there a way to change a T/F signal at varying amounts of time after the beginning of the first iteration of the timed loop. For example, if the timed loop is stopped after 60 seconds (60 one second iterations), how do I time and change a boolean at say 1 second, 2.5 seconds or 3.05 seconds without slowing the process of the timed loop?

I cannot figure out what you actually want. Once the timed loop is stopped, you cannot slow the process of the timed loop. Of course you can always keep track of time and insert <1s delays inside your timed loop at appropriate intervals. For example, you could get the elapsed time and switch the boolean immediately at the start of iteration 1 (=1 second), 0.5 second into interation 2 (2.5seconds) and 0.5 seconds into interation three (3.05 seconds). Depending on what else executes at each iteration, this may be more or less accurate.

Maybe you should run your T/F output in a parallel loop with it's own timing.

Can you attach a simplified example VI of what you are trying to do?

0 Kudos
Message 2 of 6
(3,468 Views)
Sorry if I wasn't clear enough, but your answer was helpful. I guess all I want to do is change the boolean at some set time after a 1 second iterating timed loop begins.  I guess if I wanted to do this after 5.5 seconds, I would throw it 0.5 seconds after i=4 for the timed loop. My question then is, what is the best way to time 0.5 (or .05) seconds accurately and without having to interrupt the timing of the timed loop. 
0 Kudos
Message 3 of 6
(3,447 Views)
There are a few ways to accomplish this.  The way I would do this is to execute the timed loop at .5 second intervals and wait for the iteration counter to be larger.
Message 4 of 6
(3,419 Views)
Unfortunately, the amount of time until the boolean is changed needs to be able to be chosen by the user, so I can't just change the loop interval every time. You said there were other ways to do this, what is another while keeping the loop at 1 second intervals but still getting an accurate configurable time(such as 2.5, 3.06, etc.)?
0 Kudos
Message 5 of 6
(3,409 Views)
Though not as clean a method, you can create delays using while loops and the timing palette.  There are several options of doing this ranging from a simple wait function to comparing timestamps.
Message 6 of 6
(3,390 Views)