cancelar
Mostrando los resultados de 
Buscar en lugar de 
Quiere decir: 

End While Loop after False Case Structure is Executed

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.

0 kudos
Mensaje 1 de 8
6.221 Vistas

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)

0 kudos
Mensaje 2 de 8
6.204 Vistas

When I connected the continue if true to the AND function it stopped the loop prior to executing the false case.

0 kudos
Mensaje 3 de 8
6.196 Vistas

I would recommend adding a case structure with an enum. Have attached the code, check if it works.

 
0 kudos
Mensaje 4 de 8
6.188 Vistas

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!

0 kudos
Mensaje 5 de 8
6.184 Vistas

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.

Mensaje 6 de 8
6.181 Vistas

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.

0 kudos
Mensaje 7 de 8
6.122 Vistas

Loops always complete internal code before exiting, so it should work fine, assuming the stop terminal understands that dynamic data.

0 kudos
Mensaje 8 de 8
6.112 Vistas