Log in

View Full Version : boolean equations to relay commands


windell747
31-01-2009, 22:32
Hi, I'm controlling one relay using two buttons. When one button is pushed the relay is set to forward, when the other button is pushed, the relay is set to reverse. When niether buttons or both buttons are pushed the relay is set to off. I've written up a couple boolean equations for forward and reverse. Here they are

F=A + (notB)
R=B + (notA)

However, since the relay set vi doesnt except a boolean, im not sure how to actually set the relay direction using these equations. Does anyone know how to do this?

EricVanWyk
31-01-2009, 22:50
I've attached some pseudo code that might do it for you. The basic thought is to use a case structure to convert your two booleans into the values you need for the set command.

Alan Anderson
01-02-2009, 00:20
To simply use a boolean result to select between two values of another type, I think a case structure is overkill. Using a "boolean selector" is easier and results in code that can be seen all at the same time. Here's an example of it in use:
http://bp0.blogger.com/_eSn9LaAIVHY/SGmGlg9jnkI/AAAAAAAAANE/YTO7_qLtiwg/s400/LV+-+Latch+Value+Prog.jpg
Ignore the surrounding loop and associated shift registers, and focus on the boolean input to the selector. When it is true, the top numeric input appears on the output; when it is false, the bottom numeric input appears on the output. This works with relay constants just as well as it does with numbers.

windell747
01-02-2009, 04:48
wonderful! When I tried putting a boolean selector in my code I wasnt sure how to define the true and false cases as the relay input values. I was able to set the inputs as constants, but I realize that that is not what the set relay vi needs.