09-04-2014 11:21 AM
Hello Labview Experts (and life savers actually !!)
In my VI ,I have a numerical controller (knob) feeding a numerical indicator ,in addition to a bolean input.
As an initial state the numerical indicator will contain a certain value (zero for example) and will only receive the variation in the knob input as long as the bolean input is true and then add it to this initial value.
what is the variation ? lets say that the knob was on 8 before i hit the boolean true ,the indicator's value is zero ,and then I hit the boolean true ,
Now ,when i move the knob from 8 to 18 (+10 variation) ,I want the indicator to receive +10 and add it to the zero ,now the result is 0+10=10.
Now the boolean is false ,I move the knob and nothing happens to the 10 in the indicator.
Now the boolean is true again ,let's to say the knob was on 4 at the time i hit the boolean true ,and I move it from 4 to 1 (-3 variation) ,the indicator's value now will be 10+ (-3) = 7
I hope I explained the idea in a clear way ,I would be very thankful if someone would help me with that.
P.S. I only attached the vi for illustrating the idea.
Thanks in advance
Solved! Go to Solution.
09-04-2014 11:32 AM
@shadymohamed wrote:
P.S. I only attached the vi for illustrating the idea.
What have you tried? I'd suggest an Event structure and, perhaps, a shift-register thrown in there.
09-04-2014 11:36 AM
I have tried a case structure ,but this only left me with the indicator either displaying the current knob value ,or not (in case of false for the structure)
and concerning shift register ,I'm actually not that clever with them
can you please explain more with what you suggested ?
thank you
09-04-2014 12:34 PM
Look at the example I made from your VI. It genereally does what you described, if I understood correctly.
You need to think about what to do if you changed the knob while Boolean was FALSE and then switch Boolean to TRUE. I hope this helps.
09-04-2014 12:42 PM - edited 09-04-2014 12:44 PM
The event structure has a value-change event for Boolean, where it puts the new Knob value onto the shift-register if Boolean is True.
09-04-2014 01:05 PM
@jcarmody wrote:
The event structure has a value-change event for Boolean, where it puts the new Knob value onto the shift-register if Boolean is True.
Just move that boolean terminal to inside of the event case. That way you know you have the latest value of the switch.
09-06-2014 04:53 PM - edited 09-06-2014 04:54 PM
Thanks for your suggestion
I tried implementing something as you described but i think im doing something wrong because all what im getting is decimals and are not accumulating as i want it to be.
what I'm looking for to do ,is a variable (indicator) which its value is accumulating based on the increase done in the knob right after the bolean is true and when i hit false the indicator's value does not change but rather start to increase again (or decrease) according to the delta change in the knob right after the next time the bolean is true.
09-06-2014 06:04 PM - edited 09-06-2014 06:09 PM
You missed the other Event case (and a few other things):
The first image I posted is a VI Snippet. You can drop it onto a Block Diagram and it'll be converted into LabVIEW code.
09-06-2014 06:11 PM - edited 09-06-2014 06:11 PM
You only care about how much the knob changed. Therefore, you need to subtract the old value and the new value to get how much the knob changed. Then inside the case structure, add that difference to your value that belongs in the shift register.
09-10-2014 03:18 PM
Thank you ,it worked like magic 🙂 ,Thanks a lot