LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Turning a cluster of boolean controls into a ring menu?

Solved!
Go to solution
sorry..., use a value of 3 for 'logic high', 2 for 'logic low' to start with. 🙂
0 Kudos
Message 11 of 23
(2,273 Views)
This makes even less sense.  You said you had 3 boolean controls, your example shows one.  And now you are doing some math with logic high and logic low.
0 Kudos
Message 12 of 23
(2,268 Views)
Try this!  See attached.
0 Kudos
Message 13 of 23
(2,254 Views)

Sorry for the confusion.  I have include 3 boolean controls in the attached.  John

0 Kudos
Message 14 of 23
(2,248 Views)

okay... so how do you pick which of those six states is picked? You end up with three numbers at a time, so which element in that array do you choose to select your ring control value? That is where I just don't understand what you are trying to accomplish.

 

With the code you have provided you still have 8 possibilities. You've just coded them differently. Those 8 possibilities are:

 

0,2,4

0,2,5

0,3,4

0,3,5

1,2,4

1,2,5

1,3,4

1,3,5

 

That's no different than Example 1 I provided. Since you still have 8 possibilities, how do you know which one to pick? That is where you would be better off using Example 1 I provided an getting rid of the combinations you don't want. 

 

Or... Maybe you should get rid of the booleans altogether and take a different approach?

0 Kudos
Message 15 of 23
(2,238 Views)
🙂 I am not looking to elliminate 'combinations' or 'permutations' of 3 boolean controls!  All I need to know is which switch was pressed last or the 'most current' state that switch is in - that is all I need to pass.  All told, I have a total of 'Twelve' switches I need to work with but only one that has most recently been used.  I have already succeeded in doing so - but have had to use 3 to 4 shift registers (for each boolean control!!) to 'capture' the most current state of the last switch to be pressed.  On top of that I have to use this vi (with 12 switches) as a subvi for another program and when I try to do so passing only the shift register initialization values there are too many 'combinations' to keep track of - short of having to reconnect every shift register for every boolean control!  That is a task I would rather not have to put up with.  By taking the path I have choosen I should be able to locate and pass the state (again of the most recent boolean control) using conventional array manipulations and using 'number to boolean array' conversions to again indicate whether a switch is on or off.  Thank you for your patience and Merry Christmas by the way!  John 
0 Kudos
Message 16 of 23
(2,224 Views)
I'm not certain I understand what you're trying to do, but see if the attached VI helps.  It demonstrates how you can use a single shift register to store an entire cluster or array of booleans and determine which one changed, and convert that to the appropriate "logic value" in your terminology.
0 Kudos
Message 17 of 23
(2,204 Views)
Solution
Accepted by Newton2this
That is exactly what I am looking for!!!!  Can you give me an insight into how you went about creating this 'revision'?  I may need to understand the rationale you used if I need to expand on it.  Like I said, currently I have a total of 12 switches I have to manage I am only 'assuming' I can add 9 more booleans to your vi w/o any further complications.  Thank you very much for your patience and help!  John 
0 Kudos
Message 18 of 23
(2,192 Views)

 

This will work for any number of booleans without changes, just add more controls to the cluster. 

last changed boolean.PNG

The first step is to turn the cluster into an array of booleans, and then convert those to the corresponding integer values.  The value of any boolean is 2 x array index plus one if that element is true.  That's what the top for loop does.

To find the value of the last element that changed, compare the previous array value to the current one.  Search the resulting array for a TRUE value; if found, the index is the value that changed.  Pull that element out of the current array and convert it to a numeric value as above - multiply the index by 2 and add one if true.

Finally, store that computed value in a shift register, and only update it when one of the booleans has changed (the index from the search is greater than or equal to 0).

 

PS generally you should mark the post that solved your question as the solution, rather than marking your own post.

0 Kudos
Message 19 of 23
(2,157 Views)
Yeah, I should have marked your post as the accepted solution - sorry about that!  Thank you for the vi explaination though.  I just have one more question.  I was under the impression a For Loop would not execute w/o wiring its count terminal.  Can you ellaborate on the For Loop function in displaying the array?  Thank You, John
0 Kudos
Message 20 of 23
(2,147 Views)