08-18-2009 02:44 PM
I have two loops. Once continuously runs for two seconds at a time and the second should run for 0.2 seconds (and light an LED) upon completion of the first loop. All-the-while the first loop keeps looping.
Where am I going wrong? I attached what I have so far.
08-18-2009 03:05 PM
08-18-2009 03:24 PM
jack47 wrote:
Remove the outer loop, let the loops run in parallel and you should get the behavior you want.
Close, but they'll just run once.
Try this:
08-18-2009 03:36 PM
Jack is right, but you have quite a few more misconceptions.
techsound wrote:I have two loops.
No, you have three loops.
techsound wrote:Once continuously runs for two seconds at a time and the second should run for 0.2 seconds (and light an LED) upon completion of the first loop. All-the-while the first loop keeps looping.
Maybe you can explain this a little more clearly, because it makes no sense. The first loop cannot complete and keep looping at the same time. It's one or the other.
Also, your use of 0ms wait is odd. Since the waits are outside the inner loops, they don't do anything useful. You can set the "elapsed time" express VIs to autoreset, so the inner loops, shift registers, and boolean logic are not needed. Also use a reasonable finite wait to prevent the loops from spinning an an excessive rate.
08-18-2009 03:48 PM
08-18-2009 03:52 PM
08-18-2009 06:57 PM
When I said that the loops will run only once, I was referring to the fact that the Stops were OR'd with Time Elapsed, so even in parallel, they will not keep spinning. Sorry, I didn't explain myself. Maybe your "outer loop" was meant to provide the continuous run? Yes it does, but refer to Jack's answer for that.
Altenbach makes a very important point about putting a small delay inside each loop. Generally as few as 5mS is fine, even 1 or 0* can often make a big difference. Start Task Manager and look at the CPU usage difference with/without the timers.
*yes 0 helps too, but that's another topic 😉