Simple Logic Gates

Logic gates are at the heart of digital electronics. In digital electronics, we need to know nothing about electricity, other than the difference between on (1) and off (0).

Digital electronics is widely used in telecommunications, computers, and sound recording. All digital devices are based on these simple building blocks. In a digital camera, there are millions of these gates. The NOT gate

The simplest of all the logic gates is the NOT gate. Notice that when we write the name of a logic gate, we always write it in UPPER CASE letters. Truth tables summarise the output condition for a variety of input conditions. For the NOT gate the truth table looks like this:

 INPUT OUTPUT 0 1 1 0

The NOT gate is often called an inverter.  It is made from a single transistor that acts as a switch. When there is a high voltage at Vin, there is a current through the bias resistor.  The voltage on the base of the transistor is 0.6 V so that it turns the transistor on.  This turns on the current through the load resistor.  As the conducting transistor has a very low resistance, we can say that the voltage at Vout is very close to zero.  Therefore we can say that the transistor has an inverting function.

The AND gate For the AND gate the truth table looks like this:

 A B OUTPUT 0 0 0 1 0 0 0 1 0 1 1 1

We can show the AND gate as a simple circuit of two switches in series. When both switches are closed, the bulb lights up. The AND gate performs the same task as arithmetical multiplication.

The OR gate For the OR gate the truth table looks like this:

 A B OUTPUT 0 0 0 1 0 1 0 1 1 1 1 1

The OR gate is the logical equivalent to arithmetical addition.

The OR gate can be made from two parallel switches. The light bulb lights up when either of the switches is closed OR both. Note that we do not get double brightness when both switches are on.

The Exclusive OR gate For the EX-OR gate the truth table looks like this:

 A B OUTPUT 0 0 0 1 0 1 0 1 1 1 1 0

The exclusive OR (EX-OR) will only return a high output is either one or the other input is high, but not both.

The NAND gate For the NAND gate the truth table looks like this:

 A B OUTPUT 0 0 1 1 0 1 0 1 1 1 1 0

The NAND gate gets its name from the contraction of NOT and AND. The small circle on the output line tells us that it has an inverting function. NAND gates are particularly easy to make, and other gates are actually made up of combinations of NAND gates. We will look at this later. The NOR gate For the NOR gate the truth table looks like this:

 A B OUTPUT 0 0 1 1 0 0 0 1 0 1 1 0

 Do the interactive matching exercise Logic Gates and Systems

Logic gates are processor systems.  The inputs would be the outputs of two other subsystems, for example a light sensing subsystem and a heat sensing subsystem.

The output of a logic gate provides too little current to drive much more than an LED, even when it is at logic state 1.  Therefore it has to be fed into a driver subsystem in order for an output device such as a relay and or a motor to work.

In real world electronics, the logic gates need a voltage of about 5 V to work.  Any signal above about 3.5 V is considered to be HIGH.  Anything below 3.5 V is LOW.  However you need to be careful, because a LOW output (0 in theory) might give a voltage that is more than enough to turn on a transistor.

Combining Logic Gates

The output of one logic gate can be connected to the input of another. The example is a simple system using a NAND gate with a NOT gate. Do the interactive matching exercise to work out the output of the combination. You should find that it's the same as an AND gate

Now try something a little more complex: Question 3 Do the interactive matching exercise to work out the output of the combination. Making Gates from NAND gates

It is more economical to make circuits from just one kind of chip and many circuits are made up of just NAND gates. Let us look how: The two inputs of a NAND gate connected together make the NAND gate into a NOT gate.

In this circuit below the output of a NAND gate is inverted by the NOT gate to produce the output of an AND gate. We can show this in a truth table:

 A B C Q 0 0 1 0 0 1 1 0 1 0 1 0 1 1 0 1

Look at this circuit: Question 4 Do the interactive matching exercise to work out the output of the combination. Boolean Algebra

Boolean algebra was invented by George Boole (1815 - 1864). In digital electronics it does the same job as a truth table, but with symbols. A Boolean expression tells us what condition will give an output of 1.

For a NOT gate the Boolean expression is: The symbol Ā is pronounced “A-bar”, and means that the state Q is opposite to the state Q. So the statement says “Q is equal to NOT A”.

This means that the output Q is a 1 when A is a 0.

The truth table associated with the statement is:

 INPUT OUTPUT 0 1 1 0

For an AND gate the Boolean expression is: The dot between the A and the B mean that both A AND B have to be 1 for Q to be 1. The expression is pronounced, “Q equals A dot B”. The equivalent truth table is:

 A B Q 0 0 0 1 0 0 0 1 0 1 1 1

For the OR gate the Boolean expression is: This is pronounced, “Q is equal to A OR B” and the truth table is:

 A B Q 0 0 0 1 0 1 0 1 1 1 1 1

We looked at this example using truth tables. Now we are going to analyse it using Boolean algebra. Analyse this circuit using the questions.

Analyse this circuit using the questions.

Step 1

 Question 5 Answer the interactive question to work out the output Q in terms of C and D Step 2

 Question 6 Answer the interactive question to get C Step 3

 Question 7 Answer the interactive question to get D Step 4

 Question 8 Answer the interactive question to get Q in terms of A and B. Now you will need to look at some rules that will help you to simplify the expression you have just worked out:

 Name Boolean Expression T4 (Identity Law) A.A = A T4 A + A = A T4 A = A (“NOT NOT A”) T7 A.0 = 0 T7 A + 0 = A T8 A + 1 = 1 T9 A.Ā = 0 T9 A + Ā = 1

Step 5

 Question 9 Answer the interactive question to get Q in terms of A and B in simplified terms. The rules help us to simplify a lot of more complex expressions.

We can build a circuit using a Boolean expression, which we will look at now.

 A B OUTPUT 0 0 0 1 0 1 0 1 1 1 1 0

1.  Look at where the output is 1.  It occurs when A is 1 and B is 0, we get a 1, or when A is 0 and B is 1.  We can write this in Boolean notation as: 2.  This means that we need an OR gate to give us the output Q.  So here is the OR gate with its inputs: 3.      To achieve the inputs we need to have two AND gates, each of which has ONE of its inputs inverted.  This part of the circuit will give out 1 when A = 0 and B = 1. 4. This part of the circuit will give out 1 when A = 1 and B = 0 5.      So now we need to connect each part to the two inputs A and B. 6.      Now we need to connect up our circuit to the OR gate: When you wire it all up on a logic tutor board, you get an impossible tangle of wires! A reminder of the rules:

Simple Logic Gates

• The NOT gate gives a 1 when input A is 0.

• The AND gate gives a 1 when both A AND B are 1;

• The OR gate gives a 1 when A OR B are 1 or both;

• The Exclusive OR gate gives a 1 when A or B are 1 but not both;

• The NOR gate gives a 1 when both A and B are 0;

• The NAND gate gives a 1 when either A or B are 0;

• The outputs can be summed up in truth tables.

Combining Logic Gates

• The output of one logic gate can be connected to the input of another.

• Truth tables can be made for simple combinations.

Boolean Algebra

• States what the inputs must be for an output to be 1;

• Can simplify the design of circuits;

• Has rules to simplify long expressions.