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: 

How can I use multiple front panel controls to be mirrors of each other?

Hi All:

 

    I know this is going to be a strange question, but I have multiple inputs that control one output.  This in itself not necessarily difficult, but I have a strange need.  If one of the control inputs change I would like this to be indicated by the other controls.  For example, I have a slider, numeric and dial controls on the front panel that control RPM.  If the slider changes to 1000 RPM I would like the numeric and dial controls to see that change.  Is this possible.  If so, can you give me advice on doing this.  I am using 7.1.  Thanks for the help.

 

John Honnold

0 Kudos
Message 1 of 8
(4,194 Views)

Sure, you can do it in a variety of ways... but you have to be careful.

 

One is by creating local variables of the indicators you want to change and hooking them up where "the control inputs change".  The downside of this is that you can create race conditions.

 

Another way is to use references and set the values with property nodes.  The nice part about that is you can even make changes on the front panel from subVIs.  Again, you have to worry about race conditions.

 

Now, you can reduce the chances of a race condition with careful coding... but I'd have to see your code to say anything more.

 

These are one of the few circumstances where I use local variables -- anybody else got an idea?

 

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




Message 2 of 8
(4,191 Views)

This is very easy to have race conditions doing this with local variables.  With 3 controls to syncronize, you have 3 potential sources of data.  Whenever you change one, you have to send the data to the other two.  If you just use local variables or property nodes, which ever one you are in the process of changing could wind up getting overwritten by old data from the other ones depending on what wire is executing at that moment.  It will appear the control you are changing just keeps snapping back.

 

What you need to do is use an event structure looking for the value change on each control.  Then have the new value be sent to a local variable or a Value property node of the other two within each of the events.  DO NOT use Value (signalling) property node because if you change one, and write to Value signalling it will trigger the event structures on the others, and you will quickly have a flood of Value Change events occurring.

Message 3 of 8
(4,178 Views)
Good point, Ravens Fan.  Might want to consider a queue based state machine, too.
-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 4 of 8
(4,175 Views)

What you want is not that hard, but asked for a rather  limited times.

Here's a how to:

  1. Drop a slider
  2. Right click Visible items-> Digital display
  3. Right click on the slider Advanced-> Customize
  4. Right click on the Digital display Replace select the control you want to replace it with (a gauge for instance)
  5. Right click on the Gauge Visible items -> Digital Display

Now you have one control with three control options:

 

This was done in 8.2 but I think the same goes for 7.1

 

Ton

 

 

Message Edited by TonP on 04-06-2009 09:52 AM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 5 of 8
(4,143 Views)

 

Thanks everyone.  Ton's idea worked great.  Now I only have one other question/problem.  Along with synchronous control I also have some booleans that will be used to control the RPM.  In example, there is a button that when pressed changes the RPM to the RPM the button is pressed.  This is done no matter what the prior RPM was.  I have a control cluster for the RPM, but I am not sure how to add buttons for more specific control. Any ideas?  Thanks again for all of your help.

 

John

0 Kudos
Message 6 of 8
(4,118 Views)

Hi Again:

 

    I got my system to work.  I used an event structure.  When any of the buttons on the front panel were pressed the structure would see the change and modify the slider and numeric controls using a property node.  It seems to work

fine with no race condtion problem.  Does this make sense or will I run into problems that I am not seeing?  Thanks again for all of your help.  It would have taken me a long time to figure this out on my own.

 

John Honnold

0 Kudos
Message 7 of 8
(4,089 Views)

One of the issues might be that it is tricky to change any of the scales via VI server.

Another one is that you can't place the controls on seperate pages of a tab control.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 8 of 8
(4,077 Views)