12-11-2012 12:34 AM
Hey,
This is probably a noob problem, but I'm trying to run a while loop with a case structure in it. The condition for the case file is either a clock runs down (in another while loop) OR a button is pressed. However, I can only get the clock while loop to run, followed by the case structure while loop, when I want them to run simultaneously. Also, the idea for the countdown while loop itself I got from another poster and slightly modified. I've attached a copy of my practice vi.
12-11-2012 01:02 AM - edited 12-11-2012 01:03 AM
You said it yourself:
"The condition for the case file is either a clock runs down (in another while loop) OR a button is pressed."
LabVIEW is a dataflow paradigm. Data on the wires determines what happens next. Your second while loop won't run until the first one is finished and feeds the two values (boolean and double) to the second while loop.
What do you want the second loop to do while you're waiting for either the count down or the button press?
And you can get rid of the sequence structure. It's not needed. You can drive the last bit of DAQ writes with the error out of your second while loop.
12-11-2012 01:41 AM - edited 12-11-2012 01:43 AM
In the real vi, that second while loop is for taking in data from a bunch of sensors and run a centrifuge. Every so often, the centrifuge needs to be "flushed," and so it needs a loop that's set on a timer that can also be triggered manually should the operators have the urge to flush the centrifuge.
Also, that "error out" bit was a nice tip. I think I did it in this updated version.
12-11-2012 02:05 AM - edited 12-11-2012 02:07 AM
Ok, now you want to have both loops running in parallel. Take a look at the Notifier operations. You can use them to "notify" your sensor/centrifuge loop when the count down or button press occurs. (Use a small timeout value for the Wait for Notifier so your loop isn't slowed down too much).
Also, I would recommend a user event structure to handle the button press/count down (surround it with a while loop). Example:
Hopefully that will get you started. (Don't forget error handling that I omitted for brevity)
12-13-2012 12:15 AM
Thanks a bunch! Here's my updated version. The "end blink" notifier uses the "timed out?" to control the loop, while the "end timer" uses the normal "notification" to control that loop. I've also noticed that with 2 notifier operations, it runs a tiny bit slower than before and that I have trouble placing Release Notifiers, so I didn't include any.
12-13-2012 12:51 AM - edited 12-13-2012 12:53 AM
Better!
Some other observations after a quick look: