LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

De-selecting switches

I am currently writing an application that requires the selection of
one of four switches used to drive an index head to a specific
position. The switches are set up as a cluster of four. When the index
head reaches the desired position, optical switches are activated
which removes the drive signal and activates a brake to hold the
current position. The operator then performs whatever test he must and
moves to the next position, which is arbitrary. My problem is this:
The operator must first de-activate the previous switch before
selecting the next position. Sometimes this is not done and causes
problems. I need to find a way to automatically de-select all other
switches whenever the selected switch is pressed. In other words,
pressing switch numbe
r 1 will reset switch 2-4. Pressing switch
nunmber 2 will re-set switch 1, 3 & 4. I need this very badly. I have
tried various things with no success. Is it possible to do this? The
switched are set up as Switch When Pressed. It is not possible to use
Switch Until Released due to the support electronics. Any help or
suggestions will be greatly appreciated. Thanks.
0 Kudos
Message 1 of 4
(2,754 Views)
There's a few techniques. What I do is to make an array (or cluster if
they're not identical in appearance) of switches and periodically compare
the array with a cached copy. If it has changed, then I find the new button,
set all the others "off" and write the new array value back to the control
via a local. If two buttons have been pressed since the last poll, all
buttons are switched off.

Another way I've never done is to customise a slider control so it looks
like the slider is an "on" button against a background of "off" buttons.
Clicking on one of the "off" buttons moves the slider over it, making it
look as if it has switched on while the previous one switches off. This is a
bit tedious to do and it's not very flexible, but if you're happy with it it
ce
rtainly simplifies the code.

An alternative and simple change to your existing application would be to
set the switch "false" using a local after the function it carries out has
completed executing, but this means you can't catch an intermediate
selection change.

frank wrote in message
news:bb3c5523.0111150709.405a346f@posting.google.com...
> I am currently writing an application that requires the selection of
> one of four switches used to drive an index head to a specific
> position. The switches are set up as a cluster of four. When the index
> head reaches the desired position, optical switches are activated
> which removes the drive signal and activates a brake to hold the
> current position. The operator then performs whatever test he must and
0 Kudos
Message 2 of 4
(2,754 Views)
You can programmatically test and control switches position and the associated procedures using local variables in a "state machine" like diagram. Isn't this sufficient to your case ? - oz
0 Kudos
Message 3 of 4
(2,754 Views)
What you are looking for is called a radio button - only one in the set can be turned on at once. There is an example in LabVIEW of this type of control in: Examples>General>Controls>Boolean.llb. There are a couple of examples of radio buttons. See if any of these work for you.

Rob
0 Kudos
Message 4 of 4
(2,754 Views)