12-24-2009 11:19 AM
12-24-2009 11:30 AM
12-24-2009 12:10 PM
12-24-2009 12:34 PM
Sorry for the confusion. I have include 3 boolean controls in the attached. John
12-24-2009 01:20 PM
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?
12-24-2009 02:01 PM
12-24-2009 07:45 PM
12-25-2009 12:56 PM
12-26-2009 09:40 AM
This will work for any number of booleans without changes, just add more controls to the cluster.
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.
12-26-2009 01:53 PM