LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change the value of a number by ones, tens, hundreds or thousands in LabVIEW


@Stardust95 wrote:

Yep, just a question, is there a way to put arrow keys instead of the slider? I mean in a numeric control itself, or is this the only way possible to do it? Thanks for the help. 😄


There are thousands of ways to do this and everything is possible. I would probably use an enum for the scale selection, or maybe a radiobutton control.

 


@Stardust95 wrote:

Edit: is there a way to make the add and subtract buttons into one? Just curious.


A button only has two possible states, you need three (increment, decrement, do nothing). You need two buttons, either "(1)inc/dec , (2)direction" or "(1)inc, (2)dec".

0 Kudos
Message 11 of 23
(1,177 Views)

For the first question I want to navigate from ones to thousands, for example, using horizontal buttons I can choose between ones, tens, hundreds or thousands, and vertical buttons to increment or decrement.

 

For the second question: ok, just want to make sure haha

0 Kudos
Message 12 of 23
(1,170 Views)

@Stardust95 wrote:

For the first question I want to navigate from ones to thousands, for example, using horizontal buttons I can choose between ones, tens, hundreds or thousands, and vertical buttons to increment or decrement.


Explain the words "navigate", and horizontal and vertical buttons. Maybe you could show us graphically how you want the front panel to look and how the user interacts with it.

 

Here's an example using the radiobuttons I mentioned.

 

altenbach_0-1619469379609.png

 

 

0 Kudos
Message 13 of 23
(1,164 Views)

 


@Stardust95 wrote:

For the first question I want to navigate from ones to thousands, for example, using horizontal buttons I can choose between ones, tens, hundreds or thousands, and vertical buttons to increment or decrement.


 

You've been given all of the information you need then.

 

Look at my previously attached code - extrapolate from there for using "Left", "Right" VKey.  However, altenbach's suggestion of using an enum or a radiobutton might be a better route to go.

0 Kudos
Message 14 of 23
(1,163 Views)

@Stardust95 wrote:

For the first question I want to navigate from ones to thousands, for example, using horizontal buttons I can choose between ones, tens, hundreds or thousands, and vertical buttons to increment or decrement.

 


Are you talking about buttons on the front panel or the arrow keys of the keyboard?

0 Kudos
Message 15 of 23
(1,156 Views)

Stardust95_0-1619469705203.png

 

This is what I mean, something like this. The horizontal keys moving through the digits of the number, and the vertical keys making the sum or subtraction.

 

0 Kudos
Message 16 of 23
(1,151 Views)

On the front panel

0 Kudos
Message 17 of 23
(1,149 Views)

You can definitely do this.  It would be a good LabVIEW learning experience for you.

 

The logic on how to change different digits you already have or has been given to you.  All you really need to do is make the "digit selector" a background value you store in a shift register.  Use the right/left arrow keys to update what digit it should be operating on.  Also have it move the physical location of the up/down arrows.

 

I highly recommend using an event structure.

I also highly recommend treating the value like an integer rather than a double.  I noticed while executing yours, that if you play with it long enough, you can't get back to zero, but just nearly zero (like e-17).  That is because a double precision float can accumulate errors when you do enough math operations on it.  Treat it like an integer, you won't have that problem.  You can always divide it by 1000 or whatever in the end if you need to treat the handful of digits you have has decimal fractions.

0 Kudos
Message 18 of 23
(1,138 Views)

@Stardust95 wrote:

Stardust95_0-1619469705203.png

 

This is what I mean, something like this. The horizontal keys moving through the digits of the number, and the vertical keys making the sum or subtraction.

 


 

It would be simpler to get rid of the left/right and have buttons above/below each digit.

 

(In principle, you could turn the entire thing into an xcontrol, but let's not go there!)

0 Kudos
Message 19 of 23
(1,130 Views)

Can you share this VI? Plz

0 Kudos
Message 20 of 23
(1,125 Views)