LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I change the propreties on a numeric slider?

Hello - I have a numeric slider that I would like to have start in the MIDDLE and go from 0 to 200 on both sides. Right now the default is that the slider starts from the left and fills in towards the right, until my value of 200 at the end. I basically have a motor that goes 0-200 in one direction and 0-200 in reverse, and that is determined by the number of volts I send to it. So....I need to have the left half of the slider (0-200) be associated with 0 to 5 volts and the right hand side of the slider (is moved from the center to the right), I need it to send 5.1 - 10 volts.

How can I change these two properties?
1) Change the default to the middle of the slider and have values at either side
2) Associate the values to a number (volts)

Thanks!!
0 Kudos
Message 1 of 12
(3,598 Views)
I hope I have understood your question, since the answer below costed me some time.
1/ Use 2 cursors instead of a single cursor. Leave the second cursor at zero, then configure the sliders to fill up to each other. This is a bit tricky, since it depends on the relative position of both cursors.
2/ Handle the limit situation when the cursor is exactly at the zero position.
3/ Understand then avoid the flashing of the display when either the slide is updated before the "fill to" property as been tuned, or the reverse. Need to play with panel updates. That was the most difficult part.
4/ Arrange the slide labels.

CC
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 12
(3,581 Views)
Humpfff 😠
Don't know what went wrong !
Here is the right vi...
Chilly Charly    (aka CC)
0 Kudos
Message 3 of 12
(3,574 Views)
If I understand you correctly, your are mostly interested that the fill color always fills to zero. I also assume that this slide is a speed control that ultimately sends a voltage to the motor. I would recommend to stick with negative numbers to the left of zero, but you could use a different fill color for negative speeds.

The attached simple example (LabVIEW 7.1, let me know if you need an earlier version) demonstrates one possibility.

The slide contains two sliders, but only one is visible (The other one is always at zero). Depending on the sign of the visible slider, the fill type is updated such that the fill is always towards zero. The actual value is scaled to output the correct voltage. Some extra code ensures that the second slider remains at zero.
0 Kudos
Message 4 of 12
(3,573 Views)
Altenbach, you are quite right. I misinterpreted the question. Still, your vi should take into account the case when speed = 0.
There is still this flicker when the slide crosses the zero (no solution with defer panel update since the slide is a control...)
CC
Chilly Charly    (aka CC)
0 Kudos
Message 5 of 12
(3,560 Views)
CC

Actually, part of the flicker problem was the fact that by accindent I read the "OldVal" instead of "NewVal" in the event structure. 😞 I don't think that we need to do anything about speed=0, but I have now added a case for it anyway. 😉

Another problem was the fact that the transparent slider was on top of the colored one and it was impossible to re-grab the slider once its at position zero. I have swapped the two silders and it works much better now.

See attached.
Message 6 of 12
(3,558 Views)
Will you please convert it to LV v7.0 so I can take a look? Thanks!
0 Kudos
Message 7 of 12
(3,530 Views)
Here's the 7.0 version. I also removed another bug 😉
Message 8 of 12
(3,515 Views)
Let's try again...
Sorry, I must have uploaded a stale version while editing. Here's the correct LV 7.1 version. The only change: The two input terminals inside the case structure still needed to be swapped.

(The LabVIEW 7.0 version posted is also OK)
0 Kudos
Message 9 of 12
(3,509 Views)
So that's the VI you were debugging before you could mow the lawn for Molly! I should have guessed.

Nicely done,
John
0 Kudos
Message 10 of 12
(3,499 Views)