From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Allowing only one switch to be toggled at a time - is there a better way?

I have an external device that I intend to control which will have a number of presets.

It is critical that the user only be able to toggle one switch at a time thru LabVIEW. A switch must be un-toggled (is that even a word?) before another switch can be toggled.

In order to accomplish this, I created a .vi with a lattice-work of property nodes and compound arithmetic ORs. Though my .vi is clean, it just seems that there should have been an easier way to accomplish this.

Thoughts, anyone?


Cheers!
-darren
0 Kudos
Message 1 of 6
(2,918 Views)
There is a much easier way - you only need one control. Since you're using LV 7.1, you have the radio buttons available in the dialog controls palette. If you don't like them, you can just take a numeric slide and customize it to fit your needs (right click>>Advanced).
BTW, how did you get your property nodes to look like that? I did a quick search, but couldn't find a way. I Probably wouldn't use it, but just to know...

Message Edited by tst on 03-27-2005 11:23 PM


___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(2,916 Views)

@tst wrote:
BTW, how did you get your property nodes to look like that? I did a quick search, but couldn't find a way. I Probably wouldn't use it, but just to know...
Try: Right-click..Name Format..No Names" 🙂
0 Kudos
Message 3 of 6
(2,906 Views)
Darren
A radio button control will not exactly fit your needs because you require that the active button is turned off before a new button can be activated.

One possibility would be to use an event structure and check if the state change is allowed before feeding it to the rest of the code.

See attached LabVIEW 7.1 example.

Everything will also be MUCH simpler of you e.g. combine your controls into an array or cluster. It cannot be healthy to fill an entire diagram with duplicate code.

I am also not sure why you read all these value properties. The controls are right there to be tapped by a direct wire ;).
0 Kudos
Message 4 of 6
(2,899 Views)
Thanks for the help, altenbach.

I did the value properties because I eventually will be adding this code to a much more complicated .vi, and I was intending to put the logic off to the side and connect the controls to routines that will write values to the serial ports.

Cheers!
-darren
0 Kudos
Message 5 of 6
(2,893 Views)
I use this arrangement to implement radio buttons. The logic is very simple. I left a case statement attached to the while loop in the subVI. The case states can be tailored to control any variable you want. In my program, they controlled a communication word transmitted to another device.

I haven't tried the "built-in" methods in LV 7.1 yet. I've also used slider controls and case statements, but the risk is that the user slides through intermediate states on the way to the state he really wants.
0 Kudos
Message 6 of 6
(2,856 Views)