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

Loop Block

已解决!
转到解答

Cattura.PNG

I have a problem with this i, i's value isn't passed to the Tank variable and block this Loop work.
Can you help me?

 

I would like changing my work from this

Cattura2.PNG

To this modul

Cattura3.PNG

0 项奖励
1 条消息(共 17 条)
3,988 次查看

Please clean up your block diagram so you don't have backwards running wires.  And attach your VI.  Partial screenshots don't tell us what else is going on in your VI and are impossible to run to try out for ourselves.

 

I'm afraid I don't understand your English where you say "and block this Loop work."

 

0 项奖励
2 条消息(共 17 条)
3,980 次查看

You do strange.

While loop...
if i >= Fluido, then Fluido = i
Looks like you want Fluido = integer (Fluido)

Looks like you want Fluido = integer (Fluido)
So, your code should be

i.png

0 项奖励
3 条消息(共 17 条)
3,963 次查看

@RavensFan  ha scritto:

Please clean up your block diagram so you don't have backwards running wires.  And attach your VI.  Partial screenshots don't tell us what else is going on in your VI and are impossible to run to try out for ourselves.

 

I'm afraid I don't understand your English where you say "and block this Loop work."

 


I'm sorry for my english. I would like to do this code in Untitled1.vi
while/for {

if(buttonstop==false){

      tank=i; The value is not assigned to the tank.
}
}

0 项奖励
4 条消息(共 17 条)
3,949 次查看

See my comment on picture.

You need to understand dataflow

loops.PNG

 

0 项奖励
5 条消息(共 17 条)
3,936 次查看

Do you realize in both of your VI's you've created a data dependency where the later loops can only run after the first loop stops because you've run a wire through the loops?

 

Turn on highlight execution and watch your code run.

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

@Artem.SPb wrote:

See my comment on picture.

You need to understand dataflow

loops.PNG

 


Actually in loops 2 and 3, you don't know if they'll only run once because you don't know if stop has been pressed.  We also don't know if the value that i is being compared to is negative  or positive.  It has to be negative since i starts out as zero in order for the loop to run more than once.

0 项奖励
7 条消息(共 17 条)
3,927 次查看

@Artem.SPb  ha scritto:

See my comment on picture.

You need to understand dataflow

loops.PNG

 


I understood the dataflow. My problem is in the first cycle, the value of i is not passed to the Tank variable. The view remains locked if I run it and does nothing even if the stopbutton is false. 
The second and third cycle is not a problem, I can not understand why the first cycle does not do anything.

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

What is the value on the orange wire?  On the first iteration, i=0  So if the orange wire is anything greater than 0, the loop will stop after the first iteration.

0 项奖励
9 条消息(共 17 条)
3,918 次查看

@RavensFan  ha scritto:

What is the value on the orange wire?  On the first iteration, i=0  So if the orange wire is anything greater than 0, the loop will stop after the first iteration.


Set its value through the view before starting the program, set any value other than 0, but it does not do anything.

 

0 项奖励
10 条消息(共 17 条)
3,914 次查看