Good day everyone,
I am fairly new to LabVIEW interface and this problem might not even a "problem" to pros.
So my task is to create a system that calculates remaining weight. First, the user will enter the maximum weight available. Then, as we enter a weight value, the available weight will be decreased. The process will need 4-5 weights to be entered. I really need your recommendations on how to do this.
Thanks in advance!
First, the user will enter the maximum weight available. Then, as we enter a weight value, the available weight will be decreased. The process will need 4-5 weights to be entered.
- So you want to get the difference of two values? Use a subtract function!
- you want to repeat a certain task several times? Use a loop!
- you want to keep a value for the next loop iteration? Use a shift register!
General hint: Before starting to code you should create an algorithm. Draw that algorithm on a sheet of paper. (Yes, paper and pen…)
Thanks for your bright explanation. But still, I am clueless. The shift register does store previous values, but how do I stop it from a continuous loop; as I want to enter a new weight each time. Can you show me? I have attached you the picture of the code.
You are subtracting the same value millions of times per second, soon you'll be at -infinity. 😮
The "Weight of baggage" control will only get read once at the start of the program. If it should get read whenever it changes, place it inside the loop and use an event structure
You really need to start with a few LabVIEW beginners tutorials!
Thank you. How do I initialize the maximum weight, without causing trouble to the shift register's value? While the rest of the work involves only weight of baggage and the weight available.
How do I do that? Setting the maximum weight to max. Btw, can you please take a look on my coding attached. It seems that I could not involve the weight of baggage as I run the program.
Your event structure is set up for the value change of the wrong control. You set it for the indicator Weight Available which will never trigger an event. You need to change it to the control Weight of Baggage.
Be sure to stretch out your labels so that we can see the whole label. Since you went to the bigger font, most of the words are getting cut off.
In addition to what Ravens said: