Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   boolean equations to relay commands (http://www.chiefdelphi.com/forums/showthread.php?t=73381)

windell747 31-01-2009 22:32

boolean equations to relay commands
 
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

Re: boolean equations to relay commands
 
1 Attachment(s)
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

Re: boolean equations to relay commands
 
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:

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

Re: boolean equations to relay commands
 
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.


All times are GMT -5. The time now is 02:20.

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