# Boolean expression

1. May 29, 2014

### bennyq

Just a question if you had to write a boolean expression for a problem like this,

A motor requires three conditons ABC to be high to start, but a manual override can start and stop it (M) what is the expression for Z

so Z = ABC... how would you incorporate the overside switch.

2. May 29, 2014

### meBigGuy

I hate to just give you the answer. It is a cool problem. ABC tells you about the state of the system.

3. May 29, 2014

### donpacino

AND
OR
NAND
NOR
XOR

which would work in this situation

4. May 29, 2014

### donpacino

If you have to write out the truth table for your system

5. May 29, 2014

### jim hardy

Manual must be two bits or have memory....

i draw them out as relay contacts first then write the boolean.

Series up A B C, parallel them with Manual Start, series that combination with (not) Manual Stop.

Can you make a truth table and see if that works?

6. May 30, 2014

### meBigGuy

I think M is 1 bit and needs no memory. Can be done with 4 SPDT switches or two logic gates.

7. May 30, 2014

### jim hardy

M's spdt switch needs third state = "neither", to put ABC in control .
Classic "On Off Auto" three position switch .. SPDT but center off

Can you streamline it further ?

8. May 31, 2014

### Staff: Mentor

I'd like to make centre position "Auto" so the switch setting can be changed smoothly & without stressing the motor,
e.g. ON → Auto(on) without in the process switching OFF

9. Jun 1, 2014

### meBigGuy

I am designing it as a memoryless system.

A simple boolean experssion is power = (ABC) ^ M.

Breaking it down:

IF A & B & C & ~M then power.
IF (~A | ~B | ~C ) & M, then power.
4 SPDT switches in series
A,B,C in series through NO with M NC. So when ABC pressed, load gets power but pressing M stops it.

NC contacts of A, B, C, and NO of M connected together so if any of ABC not pressed, pressing M connects it to power.

10. Jun 1, 2014

### Staff: Mentor

Your Boolean expression seems inadequate. Have you allowed for the manual forced OFF? If ~M does not mean manual override "OFF" then you must be using another switch not mentioned here for manual override OFF?

Edited

Last edited: Jun 1, 2014
11. Jun 1, 2014

### jim hardy

In my day('65) AND was X, OR was +, which at the time seemed a bit counterintuitive.
Have they changed symbols on me ?

power = notMstop X ((A X B X C) + (Mstart))

looks to me like it still takes three states to define M - start, stop or defer to ABC. That takes two bits which leaves one possible state unused.
But i'm rusty - corrections welcome. You guys may be able to streamline around that unused fourth state and save a bit.

old jim, and feeling it.

12. Jun 1, 2014

### LCKurtz

I think I'm older than you and I agree with you. I see it as implented easily with three spst and one single pole triple throw switch. But with boolean algebra you need a start switch override and a stop switch override and you have to decide which oveerride takes precedence if they are both active.

13. Jun 1, 2014

### Staff: Mentor

Jim, besides what you recall, there is another common convention.

A large V denotes OR

an inverted V is AND (^ is the closest match on the keyboard)

an omitted symbol is also understood to be AND

Last edited: Jun 1, 2014
14. Jun 1, 2014

### jim hardy

Thanks N O !

LC Thanks

A 3 position SPDT switch with center off gives the 3 states
If they're separate switches one has to decide in hardware which gets preference, as you said.
That causes a lot of trouble for beginner programmers - when his program encounters a stuck switch contact implying an impossible condition, the program mustn't crash.

You've been there too, i see....

old jim

15. Jun 2, 2014

### meBigGuy

Hold down ABC and power is applied. Hold down ABC and M and no power
Don't hold down ABC and hold down M and power is applied.

What ever ABC does, pressing M reverses it. IF ABC has it on, pressing M turns it off. If ABC has it off, Pressing M turns it on.

Standard notation for Verilog is & = AND, | = OR, ~ = bitwise inversion, ^ = XOR, ! = logical inversion.

So the answer is (A&B&C) ^ M

4 SPDT switches connected as I described.

Don't think of M as a momentary switch that permanently reverses the state of the system when momentarily pressed. It is a switch that reverses the state WHILE pressed.

Last edited: Jun 2, 2014
16. Jun 2, 2014

### jim hardy

Gotcha, M B G .

OP didn't say whether motor was to continue running after started by an override.
So that meets the stated requirement.

What happens if ABC changes state while M is pressed ?
When i tell something to stop i expect it to stay stopped until granted permission to restart.

Last edited: Jun 2, 2014
17. Jun 2, 2014

### .Scott

As you may have gathered, there's a problem with the statement of the problem.
If the problem is truly Boolean, then all of the variables should be binary states. However, the manual override can "start or stop" the motor - which suggests three states: idle (or auto), start, or stop.

"meBigGuy"s solution (Z = (A&B&C) ^ M, below) provides a semantically correct answer to the problem - as you exactly stated it. But I wonder if that is really the problem that was asked of you or that was intended to be asked of you.

18. Jun 2, 2014

### meBigGuy

In order to do a state oriented system the states and transitions must be exactly defined.

For example, if you press M to shut the system off (while ABC==true), does pressing it again cause it to restart? (in other words, does M always toggle the system?).

Or, do you have to go through ABC== false before you can turn it back on?

Or, if you press M to turn it off while ABC is true, does ABC== false then ABC=true turn it back on?

Or, if you press M to turn it on, does ABC true then false turn it off?

One simple rule is to resample the state whenever any condition is changed? But then, if M is pressed the same time as ABC goes true, does the system go on or off.

Draw the state diagram and I can write the verilog.