LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop Block

Solved!
Go to solution

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 Kudos
Message 1 of 17
(3,129 Views)

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 Kudos
Message 2 of 17
(3,121 Views)

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 Kudos
Message 3 of 17
(3,104 Views)

@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.
}
}

Download All
0 Kudos
Message 4 of 17
(3,090 Views)

See my comment on picture.

You need to understand dataflow

loops.PNG

 

0 Kudos
Message 5 of 17
(3,077 Views)

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 Kudos
Message 6 of 17
(3,076 Views)

@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 Kudos
Message 7 of 17
(3,068 Views)

@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 Kudos
Message 8 of 17
(3,062 Views)

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 Kudos
Message 9 of 17
(3,059 Views)

@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 Kudos
Message 10 of 17
(3,055 Views)