# Basic Logic Gates, Truth Tables, and Functions Explained

Logic gates are the basic building blocks used typically in the field of Digital Electronics. Each gate performs a specific logic function behind which there is an equivalent transistor based electronic circuit.

An engineer uses logic symbols to focus on the logic expression, instead of the electronic circuits behind them.

A combination of gates connected together can perform a more complex logic function. With the aid of Boolean algebra, the engineer may be able to simplify and optimise the circuit so that it uses the least number of gates. Once the expression is derived, they implement it using digital logic chips.

The most commonly used chips are TTL (Transistor-Transistor Logic) chips, which operate at the 5 V logic level. A GCSE Computing student might for example use the 74LSXX range of chips to implement the circuit.

If you are a student, then a good lesson plan is to become familiarised with the logic symbols, truth tables, and their equivalent circuits using transistors. This article contains all of this including lab projects to build the gates with transistors. These are simple breadboard projects for experimental learning purposes, for beginners.

## NOT Gate - Inverter

 Input (Pin 1) Output (Pin 2) 1 0 0 1

The simplest gate is the NOT gate, commonly called an inverter. As you can see, an input of logic 1 gives an output of logic 0, and vice versa. This gate will therefore invert a digital signal trace on the oscilloscope.

The 74LS14 is a TTL logic chip that contains these gates. This is also one of the cheapest chips currently available. I managed to get a bag of these for a pound on eBay, and you could use it for many exciting projects.

## OR Gate

 Input (Pin 1) Input (Pin 2) Output (Pin 3) 0 0 0 0 1 1 1 0 1 1 1 1

The OR gate is one of the simplest gates to understand. When either of the inputs is a logic 1 the output is also a logic 1. The 74LS32 TTL logic chip contains these types of gates.

## AND Gate

 Input (Pin 1) Input (Pin 2) Output (Pin 3) 0 0 0 0 1 0 1 0 0 1 1 1

In an AND gate, both inputs have to be logic 1 for an output to be logic 1. Again, this is a very simple gate that you should familiarise yourself with.

The 74LS08 TTL logic chip contains many of these.

## NOR Gate

 Input (Pin 2) Input (Pin 3) Output (Pin 1) 0 0 1 0 1 0 1 0 0 1 1 0

The NOR gate is just an OR gate but with the output result inverted. So, treat the inputs as an OR and then use the NOT function on the result.

If you look at the logic symbol, it looks like an OR gate, however, there is a small circle near the output terminal which represents the NOT function. Hence, this is an OR function followed by a NOT function.

The 74LS02 is a TTL chip which contains this type of gates.

## NAND Gate

 Input (Pin 1) Input (Pin 2) Output (Pin 3) 0 0 1 0 1 1 1 0 1 1 1 0

The NAND gate is an AND gate followed by a NOT gate. Treat the inputs in the same way as an AND gate and then invert the results.

As you can see, the gate symbol has a little circle near the output terminal to represent the NOT function.

The commonly available 74LS00 TTL chip contains this type of gates. These are also one of the most widely used gates.

Just out of interest, if you connect the inputs together, it then behaves as a NOT gate would. In real life applications, you will often see a NAND gate implemented as a NOT gate.

## XOR Gate

 Input (Pin 1) Input (Pin 2) Output (Pin 3) 0 0 0 0 1 1 1 0 1 1 1 0

The Exclusive-OR gate is similar to an OR gate except when both inputs are logic 1, the output will be logic 0.

The CD4070 contains this type of gates.

## XNOR Gate

 Input (Pin 1) Input (Pin 2) Output (Pin 3) 0 0 1 0 1 0 1 0 0 1 1 1

The Exclusive-NOR gate behaves as a NOR gate would except that when both inputs are logic 1, the output is also logic 1.

It is the same as an Exclusive-OR function followed by a NOT function, hence its outputs will be opposite to that of the Exclusive-OR gate.

The CD4077 is a chip that contains this type of gates.

## Logic Technology

Although the most commonly used and known technology is Transistor-Transistor Logic (TTL), there is also such a thing as Diode-Transistor Logic (DTL), and Resistor-Transistor Logic (RTL).

Primarily these technologies are concerned with their input networks. RTL utilises resistors for the input, whilst DTL utilises diodes for the input.

In the following sections of the article, I have some example circuits showing DTL implementations, and TTL implementations.