Survey of
Basic Logic Functions

On/Off States

Consider this simple switch-and-lamp circuit. There is a power source, switch, and lamp.

While the switch is open, the lamp is not energized.

This can be called the OFF or ZERO state of the circuit.


While the switch is closed, the lamp is energized.

This can be called the ON or ONE state of the circuit.

The operation of this circuit can be represented  in a tablea special  kind of table known  as a truth table.

Input State (the switch) Output State (the lamp)
Open Off
Closed On

The status of this simple series circuit can also be represented with a binary digit.

Substituting "0" for open/off and "1" for closed/on, the truth table looks even simpler:

Input Output
0 0
1 1

 

NOTE

  • The logic-0 state is sometimes described as LOW

  • The logic-1 state is sometimes described as HIGH

The AND Logic Function

The next set of figures shows the same kind of circuit, but with two switches connected in series with the battery and lamp.  The following diagrams show the four possible states for the two switches (inputs A and B) and the reaction of the lamp (output Y)

 


Circuit

Inputs Output
A B Y
0 0 0

Truth Table

State 0: Both switches are open -- the lamp is off.

 


Circuit

Inputs Output
A B Y
1 0 0

Truth Table

State 1: Switch A is closed; B is open -- the lamp is off.

 


Circuit

Inputs Output
A B Y
0 1 0

Truth Table

State 2: Switch A is open; B is closed -- the lamp is off.

 


Circuit

Inputs Output
A B Y
1 1 1

Truth Table

State 3: Both switches are closed -- the lamp is on.

The lamp (Y) is ON, only when both of the input switches (A and B) are both ON. This example is technically known as a 2-input AND logic function. The complete truth table for this 2-input AND function looks like this:

A B Y
0 0 0
1 0 0
0 1 0
1 1 1

Truth table for a 2-input AND logic function.

This is called and AND function because  the output is energized only when input A AND input B are energized.

 

If you expand the circuit to include three switches in series (A, B, and C), you have a 3-input AND function. Notice in the following truth table that the output Y is 1 only when all three inputs are 1s. (See the shaded row on the truth table)

A B C Y
0 0 0 0
1 0 0 0
0 1 0 0
1 1 0 0
0 0 1 0
1 0 1 0
0 1 1 0
1 1 1 1

 

If you expand the circuit to include four switches in series (A, B, C, and D) you have a 4-input AND function. Notice, again, that output Y is at logic 1 only when all four inputs are at 1. (See the shaded row on the truth table)

A B C D Y
0 0 0 0 0
1 0 0 0 0
0 1 0 0 0
1 1 0 0 0
0 0 1 0 0
1 0 1 0 0
0 1 1 0 0
1 1 1 0 0
0 0 0 1 0
1 0 0 1 0
0 1 0 1 0
1 1 0 1 0
0 0 1 1 0
1 0 1 1 0
0 1 1 1 0
1 1 1 1 1

 

The OR Logic Function

The next set of figures shows a circuit consisting of a battery, lamp, and two switches that are connected in parallel with one another. The following diagrams show the four possible states for the two switches (inputs A and B) and the reaction of the lamp (output Y)

 


Circuit

Inputs Output
A B Y
0 0 0

Truth Table

State 0: Both switches are open -- the lamp is off.

 


Circuit

Inputs Output
A B Y
1 0 1

Truth Table

State 1: Switch A is closed; B is open -- the lamp is on.

 


Circuit

Inputs Output
A B Y
0 1 1

Truth Table

State 2: Switch A is open; B is closed -- the lamp is on.

 


Circuit

Inputs Output
A B Y
1 1 1

Truth Table

State 3: Both switches are closed -- the lamp is on.

The lamp (Y) is ON, when either or both input switches (A or B) are both ON. This example is technically known as a 2-input OR logic function. The complete truth table for this 2-input OR function looks like this:

A B Y
0 0 0
1 0 1
0 1 1
1 1 1

Truth table for a 2-input OR logic function.

This is called an OR function because  the output is energized when input A OR input B (or both) are energized.

 

If you expand the circuit to include three switches in parallel (A, B, and C), you have a 3-input OR function. Notice in the following truth table that the output Y is 0 only when all three inputs are 0s. (See the shaded row on the truth table)

A B C Y
0 0 0 0
1 0 0 1
0 1 0 1
1 1 0 1
0 0 1 1
1 0 1 1
0 1 1 1
1 1 1 1

 

If you expand the circuit to include four switches in parallel (A, B, C, and D) you have a 4-input OR function. Notice, again, that output Y is at logic 0 only when all four inputs are at 0. (See the shaded row on the truth table)

A B C D Y
0 0 0 0 0
1 0 0 0 1
0 1 0 0 1
1 1 0 0 1
0 0 1 0 1
1 0 1 0 1
0 1 1 0 1
1 1 1 0 1
0 0 0 1 1
1 0 0 1 1
0 1 0 1 1
1 1 0 1 1
0 0 1 1 1
1 0 1 1 1
0 1 1 1 1
1 1 1 1 1

Combinations of Logic Functions

The digital world is more than isolated AND and OR functions. There at least several combinations of logic functions, and sometimes hundreds of  them. Here are two examples of combinations of AND and OR logic functions.

Combination logic  function Example 1

A B C Y
0 0 0 0
1 0 0 0
0 1 0 0
1 1 0 1
0 0 1 0
1 0 1 1
0 1 1 0
1 1 1 1

In Example 1, input A is in series with the other two inputs. So as long as switch A is open (A = 0) output Y is fixed at 0, no matter what inputs B and C might be.  Notice in the truth table that output Y is 0 whenever A = 0. When switch A is closed (Input A = 1), inputs B and C  work together as a 2-input OR function. So when A = 1, B and C affect the output as a 2-input OR function.

 

Combination logic function Example 2

A B C Y
0 0 0 0
1 0 0 0
0 1 0 0
1 1 0 1
0 0 1 1
1 0 1 1
0 1 1 1
1 1 1 1

In Example 2, the circuit behaves like a  2-input AND  function as C is open. When C is closed, the output is 1, no matter what inputs A and B are doing.