ni.com is currently undergoing scheduled maintenance.
Some services may be unavailable at this time. Please contact us for help or try again later.
04-05-2009 06:30 PM
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
04-05-2009 06:40 PM
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?
04-05-2009 08:25 PM
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.
04-05-2009 08:42 PM
04-06-2009 02:50 AM - edited 04-06-2009 02:52 AM
What you want is not that hard, but asked for a rather limited times.
Here's a how to:
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
04-06-2009 05:28 PM
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
04-07-2009 01:46 AM
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
04-07-2009 05:54 AM
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