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

Hi, to anyone that can help me with this, I would really appreciate it. Is it possible to change the values of a number by ones, tens, hundreds and thousands? I'm trying to create a VI with this feature, more specifically in a control. I want to change ones or thousands in a single control or in a way that lets me change the value to any number I like. Thanks in advance. 

0 Kudos
Message 1 of 23
(2,451 Views)

Hi Stardust,

 


@Stardust95 wrote:

Is it possible to change the values of a number by ones, tens, hundreds and thousands? 


Yes, sure!

 


@Stardust95 wrote:

 I'm trying to create a VI with this feature, more specifically in a control. I want to change ones or thousands in a single control or in a way that lets me change the value to any number I like.


Then why don't you attach your VI?

What have you tried?

Where are you stuck?

Do you get any error messages?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 23
(2,440 Views)

If you mean to do this manually: Use the text tool to select (highlight) on digit.  Then the increment/decrement buttons will apply to that digit.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 3 of 23
(2,425 Views)

I've tried, but only using 2 controls (both with sliders), you use both sliders to sum or subtract the desired number, and then a 3rd button to make the operation. What I want is to change the 2 sliders and merge them into 1, or find a way to perform the 2 operations with only 1 control. Fortunately, I have 0 error messages regarding my VI.

0 Kudos
Message 4 of 23
(2,407 Views)

You found the way more complicated way to do things.  You even found the action "Latch Until Released"  which I have never found a good use for.

 

Attached is much easier.

 

Don't forget a wait statement in there as your VI makes my CPU run hot.

An event structure would be even better.

0 Kudos
Message 5 of 23
(2,398 Views)

Hi Stardust,

 

like this?

 

Use the options of those controls:

  • you can show text labels at the slider
  • you can change the switch mode of the buttons!
  • avoid local variables and use shift registers!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 23
(2,395 Views)

@paul_cardinale wrote:

If you mean to do this manually: Use the text tool to select (highlight) on digit.  Then the increment/decrement buttons will apply to that digit.


You don't even have to highlight the digit, just place the cursor next to it.  And the up/down buttons on keyboard will do the increment/decrement operation.  No code or buttons necessary. 

aputman
0 Kudos
Message 7 of 23
(2,386 Views)

Yep, this is useful, thanks for the response 😄

0 Kudos
Message 8 of 23
(2,377 Views)

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. 😄

 

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

0 Kudos
Message 9 of 23
(2,370 Views)

@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. 😄

 

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


For first question: look into Event Structures. You will need to use one in order to capture the "Key Pressed?" event. I've attached a VI that demonstrates the approach you should take.

 

For second question: No.  A button has 2 states: True, False.  You need at least 3 states for it to work correctly (increment, decrement, unpressed).

 

 

Edit: Just realized I maybe misread your first question. Are you expecting arrow keys to control the size of increment (because that's what the slider does), or to control the act of incrementing like my posted code does?

0 Kudos
Message 10 of 23
(2,359 Views)