LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reinitialize button to default

I have some buttons that I want to initialize back to default value or reset when another button is pressed. For example, when i press the up button i want the down button to be set false, and vice versa. I have it working for one button but it doesnt work the other way around. If someone could look at my code and see if there is something I am doing wrong or a better way to do it, it would be greatly appreciated.
 
Thanks
Mike
0 Kudos
Message 1 of 9
(4,273 Views)
You might want to look into using Radio buttons. They automatically only allow a single selection. The standard Radio button controls can be replaced with the same buttons you currently are using.

You'd end up with the same effect but would require a lot less coding. Attached is a modified version using Radio Buttons.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 2 of 9
(4,262 Views)
Mike,

It is not wrong if it works. Generally try to avoid sequence structures; use dataflow. Also the use of property nodes and local variables are usually the slowest way to change the value of a control and tend to violate the dataflow concept. They also are prone to race conditions (which I think occur in your program).

I would definitely learn about the event structure. It is designed to make user interfaces like yours easier to program. Consider using Radio Buttons for the mutually exclusive functions like UP/DOWN. It was not clear fron your description whether all the buttons are exclusive or if there are groups. A pop up option is to Allow No Selection. I do not have the time to put together an example for you now but if you cannot get it working from these suggestions, post again.

Lynn
0 Kudos
Message 3 of 9
(4,261 Views)
I believe that the attached vi is a start to doing what you want.  All buttons are set to latch when pressed so that there is no need to reset anything.  If you need to have more than one button on at a time, like Up and 20 degrees, the vi will have to be changed.  Using the event structure is the key.  I can't see the purpose of the Manual Array.  Please explain in more detail.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 9
(4,246 Views)

I need the Up and down to work together and the 20 deg. and 40 deg. to work together. Slat Bypass works on its own. 

Thanks for all your help

MIKE
0 Kudos
Message 5 of 9
(4,236 Views)

OK, here's a re-engineered version. For efficiency, it uses an event structure. (LabVIEW 7.1)

If up or down has changed AND both are true, it will take corrective actions. Same for 20/40. See if this makes sense. 😉

Note also that you don't need all these case structures, just built the array from the properly ordered boolean inputs. I don't see the purpose of the second array indicator, it is always false. I assume that e.g. 20 and UP can both be true at the same time, is this correct?

I am sure you can adapt it to your exact requirements. If not, let us know. 🙂

0 Kudos
Message 6 of 9
(4,221 Views)
Thank you very much, that is exactly what i was looking for. Thanks
0 Kudos
Message 7 of 9
(4,218 Views)
Try this:
- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 9
(4,216 Views)
(small correction)
Looking at my VI, it seems you need to initialize the shift registers (or whatever the default state should be) and bring all buttons to the default state at the program start. See attached.
0 Kudos
Message 9 of 9
(4,207 Views)