Anda di halaman 1dari 14

Introduction

Digital, or boolean, logic is the fundamental concept underpinning all modern computer systems. Put simply, its
the system of rules that allow us to make extremely complicated decisions based on relatively simple yes/no
questions.

Digital circuitry
Digital logic circuits can be broken down into two subcategories-combinationalandsequential.
Combinational logic changes instantly- the output of the circuit responds as soon as the input changes (with
some delay, of course, since the propagation of the signal through the circuit elements takes a little time).
Sequential circuits have a clock signal, and changes propagate through stages of the circuit on edges of the
clock.
Typically, a sequential circuit will be built up of blocks of combinational logic separated by memory elements
that are activated by a clock signal.

Programming
Digital logic is important in programming, as well. Understanding digital logic makes complex decision making
possible in programs.
There are also some subtleties in programming that are important to understand; well get into that once weve
covered the basics.

Think Binary!
Let's examine a typical situation. You have some sort of device that generates a logic signal.
It could be a telephone that converts your voice signal into a sequence of zeros and ones.
It could be the thermostat on the wall that generates a 1 when the temperature is too low, and a 0 when the temperature is above the set point
temperature.
The logic signal,A, takes on values of0 (FALSE, OFF)or1 (TRUE, ON). That signal might really be a voltage, a switch closure, etc.
However, we want to think in terms of zeros and ones, not in terms of the values of the voltage .

Operations on Logic Signals


Once we have the concept of a logic signal we can talk about operations that can be performed on logic signals. Begin by assuming we
have two logic signals,AandB. Then assume that those two signals form an input set to some circuit that takes two logic signals as inputs, and
has an output that is also a logic signal. That situation is represented below.

The output, C, depends upon the inputs, A and B. There are many different ways that C could depend upon A and B. The output, C, is a
function, - a logic function - of the inputs, A and B. We will examine a few basic logic functions -AND,ORandNOTfunctions and start learning
the circuitry that you use to implement those functions.

Logic Gates
If we think of two signals, A and B, as representing atruth valueof two different propositions, then A could be either TRUE (a
logical1) or FALSE (a logical0). B can take on the same values. Now consider a situation in which the output, C, is TRUE only when both A
is TRUE and B is TRUE. We can construct atruth tablefor this situation. In that truth table, we insert all of the possible combinations of
inputs, A and B, and for every combination of A and B we list the output, C.

AnANDExample

Let's imagine a physician prescribing two drugs. For some conditions drugAis prescribed, and for other conditions drugBis
prescribed. Taken separately each drug is safe. When used together dangerous side effects are produced.

Let
A = Truth of the statement"Drug 'A' is prescribed.".
B = Truth of the statement"Drug 'B' is prescribed.".
C = Truth of the statement"The patient is in danger.".
Then, thetruth tablebelow shows when the patient is in danger.

Notice that C is TRUE when both A AND B are true


and only then!

AND GATES

An AND function can be implemented electrically using a device known as an AND gate. You might imagine a system in which
zero (0) is represented by zero (0) volts, and one (1) is represented by three (3) volts, for example. If we are going to use electrical
devices we need some sort of symbolic representation. There is a standard symbol for an AND gate shown below.

Often in lab work it's helpful to use an LED to show when a signal is0or1. Usually a1is indicated with an LED that is ON (i.e.
glowing). You can use the buttons below to check out this AND gate (Note what an AND gate symbol looks like!) with a simulated LED.
Note the following in the simulation (and you can use this in your lab experiments).

To get a logicalzero, connect the input of the gate to ground to havezero (0) volts input.

To get a logicalone, connect the input of the gate to a five (5) volts source to havefive volts at the input.

Each button controls one switch (two buttons - two switches) so that you can control the individual inputs to the gate.

Each time you click a button, youtogglethe switch to the opposite position.


Once we introduce Boolean variables, we can rethink the concept of a truth table. In the truth table below, if A, B and C are truth tables
and we have an AND gate with A and B as inputs and C as the output, the truth table would look like this.

OR Gates
Consider a case where a pressure can be high and a temperature can be high Let's assume we have two sensors that measure temperature
and pressure.. The first sensor has an output, T, that is1when a temperature in a boiler is too high, and0otherwise. The second sensor
produces an output, P, that is1when the pressure is too high, and0otherwise. Now, for the boiler, we have a dangerous situation when either
the temperature or the pressure is too high. It only takes one. Let's construct a truth table for this situation. The output, D, is1when danger
exists.

What we have done is defined anORgate. An OR gate is a gate for which the output is1whenever one or more of the inputs is
1. The output of an OR gate is0only when all inputs are 0. Shown below is a schematic symbol for an OR gate, together with the
simulated LEDs and input buttons so that you can explore OR gate behavior.

NOT Gates (Inverters)


A third important logical element is the inverter. An inverter does pretty much what it says. If the input is0, the output is1.
Conversely, if the input is1, the output is0. The symbol for an inverter is shown below. Again, you can putter with this inverter with the
simulated LEDs.

NAND Gates
There is another important kind of gate, theNANDgate. Actually, the way to start thinking about a NAND gate is to think of it as an
AND gate with an inverter on the output. That's shown below.

Actually, however, the symbol for a NAND gate compresses the inverter down to a dot at the output of the NAND gate as shown below.

Wiring a Quad-NAND Chip


If you want to use gates, you will need to learn something about their physical characteristics. In this section we'll walk you through
wiring a simple gate circuit using one specific integrated circuit (IC) the 7400 chip. It's a good introduction to some of the more complex
logic chips that you'll probably be using later.
Here's a picture of the7400chip in a circuit board. This chip is actually an N74LS00P. TheLStells you that it is a low power
Schottky chip. Every manufacturer will embed the 7400 or 74LS00 in other part numbers.

Notice that this chip has fourteen pins.

If you want to use an IC chip, then you will always need to know the pinout. That's electrical engineering lingo for describing the
way the pins are connected to the internal circuitry of the chip. You need to know where the power supply is connected and where the
gate inputs and outputs are connected. Here's the pinout for a 7400 chip.

The first step in wiring the 7400 is to connect the positive power supply. Use a five volt (5v) power supply and don't turn it on yet. Connect
a lead to pin 14 as shown below, and connect the other end of that lead to a 5v supply. Keep the power supply turned off until you have
everything connected. Here's what that looks like when the positive supply voltage to the chip is wired.

Boolean Algebra

Clearly at this point we are entering a realm of a different kind of algebra. We have encountered some example terms in this
algebra.

And

The algebra is unusual because the variables in the algebra (S, P, C and W in the example) can take only two values, 0 and 1. In this
section we will examine some of the properties of this algebra, and the implications of what we have already learned.

Combination Logic Gate

Combinational circuits are built of five basic logic gates:


AND gate - output is 1 if BOTH inputs are 1
OR gate - output is 1 if AT LEAST one input is 1
XOR gate - output is 1 if ONLY one input is 1
NAND gate - output is 1 if AT LEAST one input is 0
NOR gate - output is 1 if BOTH inputs are 0

There is a sixth element in digital logic, the inverter (sometimes called a NOT gate). Inverters arent truly gates, as they do not make
any decisions. The output of an inverter is a 1 if the input is a 0, and vise versa.

A few things of note about the above image:


- Usually, the name of the gate isnotprinted; the symbol is assumed to be sufficient for identification.
inputs or

- The A-B-Q type terminal notation is standard, although logic diagrams will usually omit them for signals which are not
outputs to the system as a whole.

only

- Two input devices are standard, but you will occasionally see devices with more than two inputs. They will, however,
have one output.

Digital logic circuits are usually represented using these six symbols; inputs are on the left and outputs are to the right. While inputs
can be connected together, outputs should never be connected to one another, only to other inputs. One output may be connected to
multiple inputs, however.

Truth Tables
The descriptions above are adequate to describe the functionality of single blocks, but there is a more useful tool available: the truth table.
Truth tables are simple plots which explain the output of a circuit in terms of the possible inputs to that circuit. Here are truth tables describing
the six main elements:

Truth tables can be expanded out to an arbitrary scale, with as many inputs and outputs as you can handle before your brain melts.
Heres what a four-input circuit and truth table look like:

Written Boolean Logic


It is, of course, useful to be able to write in a simple mathematical format an equation representing a logical operation. To that end,
there are mathematical symbols for the unique operations: AND, OR, XOR, and NOT.

- A AND B should be written as AB (or sometimes A B)


- A OR B should be written as A + B
- A XOR B should be written as A B
- NOT A should be written as A' orA

Youll note that there are two missing elements on that list: NAND and NOR. Typically, those are simply represented by complementing
the appropriate representation:

- A NAND B is written as (AB)' , (A B)' , or(AB)


- A NOR B is written as (A + B)' or(A + B)