Iguana Labs will be closing its doors for good around August 11th.
We will keep lowering our prices until our inventory is gone.
Click here for the latest price list and availability.
Iguana Labs                   800-297-1633
Back To Previous PageLog InHomeProductsView Cart ContentsCheckout

Microcontroller
Beginner
Kit
$149.00


Sign  Up For
Newsletter

New Products

Latest Tutorial

Feedback

Privacy
Policy

Shipping
Information
 

 

Truth Tables

Introduction

Calculators look at a list of inputs and produce an output. Computers do the same thing. We use truth tables to show this list of inputs and outputs. Inputs are limited to two possibilities, either 0 or 1. This is the meaning of digital. The name digital (or binary) means two values. A 0 is called False and a 1 is called True.

Theory

The simplest truth table is for one input and one output. In this case there are two possible truth tables. These are shown below.
 

Input
Output
0
0
1
1
Figure A

 
Input
Output
0
1
1
0
Figure B

For Figure A it is the same as having a wire connecting the input and the output. Whatever appears on the input is transferred to the output.

For Figure B, the opposite happens. This is called a NOT operation (NOT gate). The output is not the input. The output is True (1) if the input is not True (1). The output is False (0) if the input is not False (0). To learn how to build a NOT gate, go to LED and Transistor Kit.

Another way to look at a truth table is as a list of possible events and what will happen in each case. Suppose your friend John might come to visit. If he comes you will not watch Matlock. If he does not come you will watch Matlock. Then the table would look like the following.
 

Event
Result
John Comes
You Don't Watch Matlock
John Doesn't Come
You Watch Matlock

NOT GATE

We will build a device with one input and one output. We will give the device an input, either True (1) or False (0). The device will give us an output (either True or False) to tell us what happened as a result of our input. Later we will build devices with more inputs and outputs so it can do more complex things for us.

When we build this first device we will use 0 volts for False (0) and we will use 5 volts for True (1). If the input to our device is 0 volts then the output will be 5 volts. If the input is 5 volts then the output will be 0 volts. This will be our first logic gate, the not gate. It is also called an inverter. Logic gates are devices that are built to do truth tables. Computer chips like the Pentium are made of logic gates.

AND GATE

Now lets look at a device with two inputs and one output. First, we will look at a device that does an AND operation. Our inputs will be A and B. Our output will be C.

If A and B are both True (1) then the output, C, will be True (1). Otherwise C will be False (0). This operation is shown in the truth table given below.
 

Input A
Input B
Output
 
Input A
Input B
Output
False
False
False
 
0
0
0
False
True
False
 
0
1
0
True
False
False
 
1
0
0
True
True
True
 
1
1
1

 

The table gives a list of all possible combinations of inputs and the resulting output for each combination. This is not the only possible combination of outputs, but this paticular combination is called an AND gate.

OR GATE

Another possibility for a device with two inputs and one output is an OR operation. For inputs A and B and output C : If A or B is True (1) then C is True (1). Otherwise C is False (0).

To build the truth table, we first look at the inputs. A can be True or False. B can be True or False. First we make a table of all possible combinations of A and B.
 

A
B
False
False
False
True
True
False
True
True

Now we can determine the output by saying for each combination, if A or B is true then the output, C, is True. Then we have the following table.
 

A
B
C
False
False
False
False
True
True
True
False
True
True
True
True

Then to convert this to a form we can build (using 5 Volts for True and 0 Volts for False) we make the following table.
 

A
B
C
 
A
B
C
False (0V)
False (0V)
False (0V)
 
0V
0V
0V
False (0V)
True (5V)
True (5V)
 
0V
5V
5V
True (5V)
False (0V)
True (5V)
 
5V
0V
5V
True (5V)
True (5V)
True (5V)
 
5V
5V
5V

 

Boolean Algebra

These three gates (the NOT gate, the OR gate, and the AND gate) are the basic building blocks of digital design. They are all that is needed to build the most complex computers that exist. To build complex designs, a type of math has been developed to deal with binary numbers. It is called Boolean Algebra. It gives you a way to combine these three gates into bigger designs.

The three basic operations have symbols. A NOT operation is represented by a line over a letter. Instead of using this line we will just say ‘bar’. For example Abar means 'not A'. So if Abar is 1 then A is 0. If Abar is 0 then A is 1.

An OR operation is represented by a + sign. For example, A + B = A OR B.

An AND operation is represented by a *. For example, A * B means A AND B.

Examples

1.) If A = 1 (5V) and B = 0 (0V) then what is A * B?

Since 1 is a True and 0 is a False then we can say the problem is ~ True * False = ?. If we put in AND for * then the problem is ~ True AND False = ?. To answer this we can look back at the truth table for the AND operation and see that True AND False is False. Another way to find the answer is to look at the definition of the AND operation. It says if A and B are True then the output is True. Otherwise the output is false. In the above example since B is False the output is False so A * B = False (A * B = 0).

2.) If A = 1 (5V) and B = 0 (0V) then what is A + B?

To do this problem we can say that A = 1 = True and B = 0 = False. Then the problem is ~ True OR False = ? We can either look at the truth table for the OR operation or we can look at the definition of the OR operation which says. If A or B is True then the output is True. Otherwise the output is False. Since A is True in our question then the output is True. So True + False = True (1 + 0 = 1).

Try doing the following problems using the truth tables and the definitions above. The answers are given below.

1.) A = 1 (5V) and B = 0 (0V). What are the answers for the following problems?

a.) A + B = ?
b.) A * B = ?
c.) Abar = ?
d.) Bbar = ?

2.) A = 0 (0V) and B = 0 (0V). What are the answers to the following problems?

a.) A + B = ?
b.) A * B = ?
c.) Abar = ?
d.) Bbar = ?

3.) A = 1 and B = 1. What are the answers to the following problems?

a.) A + B = ?
b.) A * B = ?
c.) Abar = ?
d.) Bbar = ?

4.) A = 0 and B = 1. What are the answers to the following problems?

a.) A + B = ?
b.) A * B = ?
c.) Abar = ?
d.) Bbar = ?

Answers:

1. a.) 1 (5V) b.) 0 (0V) c.) 0 (0V) d.) 1 (5V)

2. a.) 0 (0V) b.) 0 (0V) c.) 1 (5V) d.) 1 (5V)

3. a.) 1 (5V) b.) 1 (5V) c.) 0 (0V) d.) 0 (0V)

4. a.) 1 (5V) b.) 0 (0V) c.) 1 (5V) d.) 0 (0V)

For more about Boolean Logic get the book Bebop to the Boolean Boogie

This page last updated on April 7, 2003.