LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

controlling numeric slider with numeric control

Hello,
what i have is a numeric slider and a numeric control.  i would like to be able to move the slider and have it update the value in the numeric control and vice versa.  the problem is that i can update the value in the numeric control when i move the slider, but i can't update the slider if i try to change the value in the numeric control.  i was trying to use the 'value' property node for each of them and and wire each of the controls to the opposite property node.  i know they are both control but i thought if i change the 'value' to an input then it may update.

i have attached the vi.

thank you
0 Kudos
Message 1 of 11
(9,433 Views)
RIght-click your slider and select "visible items...digital display". 😄
 
No code needed!
Message 2 of 11
(9,428 Views)
You have a classic race condition. Don't just put them in a while loop, use an event structure with value change event for the slider and another value change event for the numeric.
Message 3 of 11
(9,425 Views)
Here's how you could do it if you really need seperate controls.
Message 4 of 11
(9,421 Views)
makes sense,
thank you
0 Kudos
Message 5 of 11
(9,414 Views)

Since this numeric_slider VI uses an event structure, it only outputs a value when the slider or the numeric control are modified. I need it to continuously output the numeric and slider control value, even if no changes are currently being made to the control value.

 

My while loop just pauses until I move the slider back and forth. I've tried a lot of things and worked on this for hours and I'm still stuck.

 

Any help or insight would be appreciated beyond measure!

 

Thanks,

 

-Adam

0 Kudos
Message 6 of 11
(8,957 Views)

Adam, this is Paul with Applications Engineering at NI.

 

I was unable to open your attached VI because it was missing simplepid.vi.  I glanced at the rest of your code, but it looks like that might be the meat and potatoes of what you're trying to accomplish.  Try putting your files into a project, then zipping them up and posting them, and we can see what we can do for you.

 

Paul

Paul Davidson
National Instruments
Product Owner - ni.com Chat
0 Kudos
Message 7 of 11
(8,931 Views)

 


@AdamKrzy16 wrote:

 

Any help or insight would be appreciated beyond measure!


 

Well, since the event structure only executes when one of the controls changes, it is blocking the loop. Dataflow in action!

 

A quick solution would be to make the event structure "transparent" by adding a short and empty timeout case. Now just use a feedback node to retain the existing value if the controls did not change.

 

There are probably definitely better ways to do this, but they would require more fundamental changes to your code.

 

 

Message 8 of 11
(8,928 Views)

Thanks! Works like a charm and makes good sense...

 

One last thing, there's one slider and TWO numeric controls to set the P-term. I would like to delete one of those numeric controls to avoid redundancy, but they seem interdependent.

 

I can't remove one of them without causing errors I can't figure out how to resolve...

 

Thanks again for the help on this,

 

-Adam

Download All
0 Kudos
Message 9 of 11
(8,913 Views)

You need to remove the one on the right, the other one belongs to the slide. since there is now only one source, you don't even need the event structure.

 

Makes sense?

Message 10 of 11
(8,896 Views)