03-27-2018 09:12 AM
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!
03-27-2018 09:36 AM
Hi Qii,
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…)
03-28-2018 12:56 AM
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.
03-28-2018 01:17 AM - edited 03-28-2018 01:17 AM
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!
03-28-2018 11:01 PM
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.
03-29-2018 12:04 AM
define what you mean by "trouble". You can initialize the shift register with the max if that's what you want.
03-29-2018 03:43 AM
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.
03-29-2018 08:18 AM
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.
03-29-2018 10:56 AM
In addition to what Ravens said:
03-29-2018 11:05 AM
Maybe this can give you some ideas .... (other event case is for max/esc: value changed)