取消
显示结果 
搜索替代 
您的意思是: 

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 项奖励
1 条消息(共 8 条)
6,114 次查看

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 项奖励
2 条消息(共 8 条)
6,097 次查看

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

0 项奖励
3 条消息(共 8 条)
6,089 次查看

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

 
0 项奖励
4 条消息(共 8 条)
6,081 次查看

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 项奖励
5 条消息(共 8 条)
6,077 次查看

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.

6 条消息(共 8 条)
6,074 次查看

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 项奖励
7 条消息(共 8 条)
6,015 次查看

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

0 项奖励
8 条消息(共 8 条)
6,005 次查看