LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to set boolean output high if its 5 boolean input high in proper sequence

Solved!
Go to solution

Dear All

lets say i have 5 boolean inputs and one output.

i want to set output high if and only if all 5 boolean input be high in proper sequence like  1,2,3,4 and then 5.

i inputs do not high in this sequence, output should not be high.

 

i am having problem doing so.

please help

 

Thanks

0 Kudos
Message 1 of 20
(4,394 Views)

I would just set up a 5-element FIFO buffer (array), and an event structure that feeds the number of the clicked button into the buffer then compares the buffer value to an array that contains the 'correct' sequence.

0 Kudos
Message 2 of 20
(4,386 Views)

There are so many ways to do this. Most scalable solutions require a array of input Booleans.

 

You don't mention if no True Boolean should result in a True or False... I'll assume it's true (all Booleans that are True are in order, even if there are none). Simply because it's easier for me... If at least one should be true, simply AND the result with the first input.

 

Then, for example:

1) Sort the array of Booleans and reverse. Compare input array with output array. If they match, the order was correct.

2) In a for loop, make a shift register and initialise it with true. Use a compound arithmetic node, with !A NAND B, A being the shift register, B the auto indexed array elements. If the result is false, stop the loop with it's conditional terminal. Output this value (set it to last value). It's true if the Booleans where in order, false if not.

3) Convert the array to number. Add one. Convert back to Boolean array. Convert to 0 or 1. Sub the elements If the result is <=1, the order was correct.

Booleans In Order Check.png

0 Kudos
Message 3 of 20
(4,332 Views)

how can i set desire sequence of boolean and output should only be true when boolean input must match with set sequence.

 

Thanks

0 Kudos
Message 4 of 20
(4,303 Views)
0 Kudos
Message 5 of 20
(4,300 Views)

yes. 

0 Kudos
Message 6 of 20
(4,286 Views)

@Asif138 wrote:

 

i inputs do not high in this sequence, output should not be high.

 


I assume that these are switch action booleans, not latch.

 

Keep the last six states of all booleans in a 2D boolean array using a shift register.

 

Create an event for whenever one of the booleans changes, rotate the columns and replace the now oldest state in the first row with the current boolean set..

 

Compare the 2D array with an array constant containing the following 2D array.

 

T T T T T (newest of last six states)

T T T T F

T T T F F

T T F F F

T F F F F

F F F F F (oldest of last six states)

 

 

If the two arrays are equal, the booleans were switched on in the correct order.

 

Even easier would be to convert the five booleans into a number and keep a 1D boolean array with 6 elements in a shift register. Compare with the numeric array corresponding to the converted 6 rows above.

 

 

0 Kudos
Message 7 of 20
(4,283 Views)

Asif138 wrote:

lets say i have 5 boolean inputs and one output.


Can you maybe clear this up a bit?

 

I read this as: I have 5 Booleans coming in from somewhere, and want to validate them.

 

The other interpretation is that you want have an interactive situation, where Booleans are being clicked.

 

Although the solutions share some parts, for a correct answer it's not clear enough what you mean.

0 Kudos
Message 8 of 20
(4,271 Views)

@altenbach wrote:

Even easier would be to convert the five booleans into a number and keep a 1D boolean array with 6 elements in a shift register. Compare with the numeric array corresponding to the converted 6 rows above.


Here's what I had in mind.

 

 

Message 9 of 20
(4,267 Views)

@Asif138 wrote:

yes. 


"Compare the two" is the solution. Use Equal?, and right click and select Compare Aggregates. Output is True if the two arrays are equal.

0 Kudos
Message 10 of 20
(4,260 Views)