10-05-2017 01:38 PM
I have all of the program executing properly except for ending the program after we have executed the false case structure. Can someone help me end the program after the false structure has been executed. I want to continue executing the while loop if the AND function is true.
10-05-2017 02:02 PM
You already have it set up right. The same condition that determines the case structure also determines whether the loop continues. Just wire that to the loop condition (continue if true)
10-05-2017 02:13 PM
When I connected the continue if true to the AND function it stopped the loop prior to executing the false case.
10-05-2017 02:27 PM
I would recommend adding a case structure with an enum. Have attached the code, check if it works.
10-05-2017 02:34 PM
I am away from my hardware and machine that has labview, but will give it a try when I get back to it next week! Thank you!
10-05-2017 02:35 PM
Don't create a DAQ task inside the loop every iteration, and certainly not if you fail to close the task. Right now your endless creation of task is a memory leak that will eventually crash your computer. Put the Create Task outside the while loop and a Clear task after the while loop.
Your True and False cases are nearly identical other than the constant wired into the analog write. No need to duplicate the code. Pull it out of the case structure other than the constants. And since it is "either" one constant or the other, get rid of the case structure and just use a Select statement.
Since your loop is set to continue when True, just wire the comparison to the Continue Terminal? It will continue the loop when true and stop the loop when false.
One problem you might have is the use of the Dynamic Data Wire. You really don't know what type of data is on that wire, boolean or numeric, and whether it is a scalar or an array. Convert the blue wire to a real datatype as soon as possible.
10-09-2017 12:28 PM
Is this how you think it should look? I still think this loop will stop before writing a 0 if the AND becomes false. Right?
I still have to place a clear task as well.
10-09-2017 01:42 PM
Loops always complete internal code before exiting, so it should work fine, assuming the stop terminal understands that dynamic data.