Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   3 outputs for 2 booleans (http://www.chiefdelphi.com/forums/showthread.php?t=91271)

siggy2xc 08-02-2011 17:48

3 outputs for 2 booleans
 
I have 2 booleans and would like to be able to use 4 different case structures depending on which are pressed.

False, False
True, False
False, True
True, True

What would be the best way to do this?

Wicked 08-02-2011 17:57

Re: 3 outputs for 2 booleans
 
You might be able to use some combination of the Boolean functions in the palette to do this.

Mark McLeod 08-02-2011 21:34

Re: 3 outputs for 2 booleans
 
Just nest one Case statement within another one.

j.cole 08-02-2011 23:31

Re: 3 outputs for 2 booleans
 
1 Attachment(s)
Thats the hard to understand way. The easy way to do it is to build an array (Build Array) and then put that array into a number (Boolean Array to Number) then put that number into a case structure (that will change the true/false selector to a 0, Default/1 selector). Now it helps to know binary at this point. You right click the selector and add a case after. Do this until you have 4 cases (0, Default; 1; 2; and 3). If both booleans are off the case is 0 (false, false). If boolean 1 is on and 2 is off the case is 1 (true, false). If boolean 2 is on and 1 is off the case is 2 (false, true). If both are on the case is 3 (true, true). See the attached picture for wiring.

siggy2xc 09-02-2011 00:26

Re: 3 outputs for 2 booleans
 
Thanks j.cole! saves me a lot of time :D


All times are GMT -5. The time now is 09:12.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi