ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connect two numeric controls on labview

Solved!
Go to solution

Hello everyone,

I would like to connect two numeric controls, meaning I need 2 controls on the front panel that will perform the same function. If I change the value of one of them, the other should automatically change as well.

Please note that one of these controls needs to be within a cluster (which I will define beforehand).

I am still very much a beginner in LabVIEW, so if you could send me a VI to show me a small example of an application, that would help me understand what I need to do.

Thank you!

0 Kudos
Message 1 of 11
(3,162 Views)

Hi sasquatchd,

 


@sasquatchd wrote:

I would like to connect two numeric controls,


You cannot connect two controls as both are data surces. (THINK DATAFLOW!)

 

But you can set one control (using a local variable of that control) with the data of the other control.

And you can use an event structure to (re)act upon value changes of your controls…

 


@sasquatchd wrote:

I am still very much a beginner in LabVIEW, so if you could send me a VI to show me a small example of an application, that would help me understand what I need to do.


As a beginner you should take note of the Training resources offered at the top of the LabVIEW board - and all those example VIs in the example finder!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 11
(3,155 Views)

Can u send me an example who do this work please ? 

0 Kudos
Message 3 of 11
(3,123 Views)

 

 


@GerdW  a écrit :

But you can set one control (using a local variable of that control) with the data of the other control.

And you can use an event structure to (re)act upon value changes of your controls…

 


do u mean that I can change the value of the two controls by changing only one of them ?

0 Kudos
Message 4 of 11
(3,118 Views)

I did this, for what I see it does what I want to do, but I dont know if it will always work 
If u can verify it for me please

0 Kudos
Message 5 of 11
(3,104 Views)

Hi sasquatchd,

 


@sasquatchd wrote:

I did this, for what I see it does what I want to do, but I dont know if it will always work 
If u can verify it for me please


Basically you implemented what I suggested.

(You may delete the TimeOut event case and and a "Stop" button value change event case.)

 

Why do you fear the VI will not "always work"? Why should it fail after one hour?

Best regards,
GerdW


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

@GerdW wrote:

 

Why do you fear the VI will not "always work"? Why should it fail after one hour?


Not after one hour, but after approx. 49.7 days, when the 2^32 tick counter will overflow... 😁

Greets, Dave
0 Kudos
Message 7 of 11
(3,070 Views)

Hi GerdW,

Haha, 


Why do you fear the VI will not "always work"? Why should it fail after one hour?


It's not about duration.

I was wondering if there is some prohibited cases for this VI, that's why i wanted to take your opinion

0 Kudos
Message 8 of 11
(3,067 Views)

@sasquatchd  ha scritto:

 

I was wondering if there is some prohibited cases for this VI, that's why i wanted to take your opinion


Yes, there is one. If you assign a value to one control via a local variable in another part of your program, the Value change event will not be triggered.

Those events will be executed, other than by direct user interaction, by a Value(signaling) property node assignment :

pincpanter_0-1701439225160.png

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 9 of 11
(3,054 Views)

You can put multiple controls of the same data type in an Event case.

This prevents the maintenance problem of duplicate code.

Connect Two Controls.png

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 10 of 11
(2,986 Views)