From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
07-23-2020 03:44 PM
I am a LabVIEW beginner. I have made a simple loop that allows you to increase current at the rate of your choosing.
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?
Solved! Go to Solution.
07-23-2020 04:23 PM
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.
07-23-2020 09:57 PM
Thanks a bunch! This definitely helped me make a step in the right direction, but I'm still getting something wrong.
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?
07-23-2020 10:17 PM - edited 07-23-2020 10:19 PM
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.
07-23-2020 10:20 PM - edited 07-24-2020 11:49 AM
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.
07-24-2020 10:49 AM
@GraceHasQuestions wrote:
Thanks a bunch! This definitely helped me make a step in the right direction, but I'm still getting something wrong.
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.
07-24-2020 09:24 PM
Yeah, you're right, I messed up with that, sorry. Thank you for your help! I appreciate it!