LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resetting an Indicator at Beginning of Loop

Solved!
Go to solution

I am a LabVIEW beginner. I have made a simple loop that allows you to increase current at the rate of your choosing. 

GraceHasQuestions_0-1595536577400.png

The only problem is, the value for the Current indicator stays after I hit abort and then run continuously again. How can I make it so that the Current is set to 0 before the loop begins?

0 Kudos
Message 1 of 7
(1,574 Views)

You will soon find that using the run continuously button is only useful for very simple cases.

 

In order to set the feedback node value before the loop starts, right click the feedback node and select "move initializer one loop out". Then you wire up your initial value to the new node on the left hand side. You can also convert to shift registers, which I find more intuitive to look at.

Message 2 of 7
(1,559 Views)

Thanks a bunch! This definitely helped me make a step in the right direction, but I'm still getting something wrong. 

GraceHasQuestions_1-1595559263548.png

 

This just keeps the current set at 1. What am I doing wrong?

 

By the way-- you said that the run continuously button is only useful for simple cases. Is there another way to do loops without using the run continuously button?

 

0 Kudos
Message 3 of 7
(1,529 Views)

What the value if the "increase by" control?

 


@GraceHasQuestions wrote:

 

By the way-- you said that the run continuously button is only useful for simple cases. Is there another way to do loops without using the run continuously button?


No loops ever require the run continuous button.

Message 4 of 7
(1,526 Views)

Also please don't show pictures. Attach the VI to your post instead so we can debug. Many things cannot be seen from a diagram picture alone.

Message 5 of 7
(1,523 Views)
Solution
Accepted by topic author GraceHasQuestions

@GraceHasQuestions wrote:

Thanks a bunch! This definitely helped me make a step in the right direction, but I'm still getting something wrong. 

GraceHasQuestions_1-1595559263548.png

 

This just keeps the current set at 1. What am I doing wrong?

 

By the way-- you said that the run continuously button is only useful for simple cases. Is there another way to do loops without using the run continuously button?

 


You should turn on highlight execution (the lightbulb tool) so you can see what is going on with the data flow. You will see:

Loop starts with current at 1

1 is less than or equal to 60 (TRUE)

Loop stops

 

Did you mean to stop when the current is >= 60?

As Altenbach said, loops do not require you to run continuously.

In fact, if you find yourself using the run continuously button, that probably means you need to wrap your code in some kind of a loop.

Message 6 of 7
(1,478 Views)

Yeah, you're right, I messed up with that, sorry. Thank you for your help! I appreciate it!

0 Kudos
Message 7 of 7
(1,451 Views)