LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Terminating while loop

Hi guys, ok im dealing with binarys' here. if i have 8bits and in the while loop i wan the program to only terminate when it reaches 11111111. how can i do it? Ending the while loop now only uses boolean how could i change it so that if the output is 11111111 the loop would stop thx.
0 Kudos
Message 1 of 8
(3,407 Views)

Since you are doing all binary 1's.  You could use "And Array Elements" from the Boolean palette and feed it to your stop terminal.  If all 1's, that is result is True and the loop stops.  If one or more elements is a 0, then the result is False and the loop doesn't stop.

Message Edited by Ravens Fan on 02-10-2009 03:17 PM
Message 2 of 8
(3,397 Views)

Boolean Palette -> Compound Arithmetic.

Stretch it to 8 inputs.

Right-click and change mode to "And".

 

Message 3 of 8
(3,396 Views)
Use the Equal? function.
Message 4 of 8
(3,394 Views)
hey guys thanks for the reply but what if i want it to stop when my output is all 1's meaning in a while loop it would start from 00000000 and loop till 11111111. thanks!
0 Kudos
Message 5 of 8
(3,356 Views)

Just use a For loop with a 256 wired to the N terminal.  The iteration counter i will run from 0 to 255, which is 00000000 to 11111111 in binary.

Message 6 of 8
(3,350 Views)
thanks for the reply. im now trying to start my binary count at 00000011 and then let it loop until it gets to 11111111 while letting only the variable in xxxxxx11 change! will repl again if i encounter some probs.
0 Kudos
Message 7 of 8
(3,325 Views)

Since you are dealing with binaries, why not work with binaries?  Simply loop until you reach the binary value 11111111 or FF (hex) or 255 (decimal).  You can start your count at any value, and no need to deal with booleans.  In this case you would use the greater or equal to function to compare whatever value (binary, hexadecimal or decimal) that you are working with. 

 

Keep it simple.

 

R

Message Edited by JoeLabView on 02-11-2009 07:59 AM
0 Kudos
Message 8 of 8
(3,321 Views)