ELECTRICAL ENGINEERING DIGITAL LOGIC TUTORIAL AND DESIGN 1.

Post on 17-Jan-2016

219 views 0 download

transcript

1

ELECTRICAL ENGINEERING

DIGITAL LOGIC TUTORIAL AND DESIGN

2

DIGITAL LOGIC LAB(A MINI-LAB EXPERIENCE)

We are going to build both a combination lock and a flashing railroad crossing signal using digital logic devices

To build these circuits we will draw upon knowledge or resources developed by several areas of electrical engineering

First, we will need to learn a little about digital logic

The worksheet “Explore Logic” in the Excel workbook entitled, “Lec9-DigitalLab.xls” may be used to verify your understanding of the next few slides

3

SOME DEFINITIONS Definition: Discrete System - a system with a finite

number of sizes or measures Shoes, Dresses, Pants, Bolts, Pencils

Definition: Digital System - a Discrete System with only two values of system variables: 1 and 0 True/False; Yes/No; Male/Female; On/Off

Let’s compare digital and continuous (analog) systems Digital signals are binary; analog signals are real-valued

numbers

Digital is less susceptible to noise

4

0

5 Analog Waveform

TimeV

olta

ge (

V)

0

5Digital Waveform

Time

Vol

tage

(V

)

1

0

1

5

AND OPERATOR Let’s look at the relationship between the

semantic and logical operator known as the AND operator

Consider:If the car is fueled AND the engine

works,then the engine will start

AND means that both conditions must be true in order for the conclusion to be true

AND OperatorTruth Table

0 0 0A B Output

0 1 01 0 01 1 1

6

DIGITAL AND

We can build an electrical device that performs the logical AND operation on voltage equivalents of logic values

An AND gate has the electrical schematic:

For digital logic:

True = 1 is 5 voltsFalse = 0 is 0 volts

AInputs

B

Output

• We will practice with the Excel spreadsheet

7

OR OPERATOR

Another basic operator is the OR

Consider:If I have cash OR a credit card,then I can pay the bill

OR works such that the output is true, if either of the two inputs is true 0 0 0

A B Output

0 1 11 0 11 1 1

OR OperatorTruth Table

8

NOT OPERATOR/INVERTER GATE

The NOT gate reverses the input

All digital computers are built using only three gate types: AND, OR, and NOT

NOT OperatorTruth Table

0 1A B

1 0

A B

9

XOR (EXCLUSIVE OR) OPERATOR

Let’s look at the relationship between the semantic and logical operator known as the XOR operator

Consider a biological example:If gender A XOR gender B,

then reproduction is possible

XOR works such that output is activated (equal to one) if both inputs are of a different value

Try the Excel spreadsheet exercise

10

DIGITAL XOR

We can build an electrical device that performs the logical XOR operation on voltage equivalents of logic values

An XOR gate has the electrical schematic:

XOR OperatorTruth Table

0 0 0A B Output

0 1 11 0 11 1 0

A

InputsOutput

B

11

DIGITAL COMBINATION LOCK

DESIGN AND SOFTWARE SIMULATION

12

MULTI-INPUT AND GATE AND gates can be built with any number of

inputs

Consider the symbol for the 4-input AND gate

F is true only when all the inputs are true (1’s: ones )

Using the Excel workbook “Lec9-DigitalLab”, open the “Digital Locks” worksheet, and test this circuit

ABCD

F

13

DIGITAL COMBINATION LOCK

Using 3 two-input AND gates, we could build a combination lock that requires a four-digit code, specifically: 1 1 1 1

The number of inputs could be increased by using more and more AND gates

AND

AND

AND 1

1

1

1

1

1

1

14

DIGITAL COMBINATION LOCK

We could build a combination lock that only uses the AND gate, but that would be of little use since everyone would know our combination, namely 1 1 1 1

To build a more interesting combination lock, we will utilize the NOT (inverter) gate

0 1

15

DIGITAL COMBINATION LOCK

Let’s build a combination lock whose input (key code) combination is 0 1 1 0

Is there any other combination that works?

AND

AND

AND

1

1

1

1

1

1

1

0

0

16

“PICKING” A DIGITAL LOCK

Use the truth table to record the lock outputs for the different lock combinations in the “Pick the Locks” worksheet homework assignment.

Input Combination Lock OutputA B C D Lock #1 Lock #2 Lock #3 Lock #4 Lock #50 0 0 00 0 0 10 0 1 00 0 1 10 1 0 00 1 0 10 1 1 00 1 1 11 0 0 01 0 0 11 0 1 01 0 1 11 1 0 01 1 0 11 1 1 01 1 1 1

17

DIGITAL RAILROAD CROSSING SIGNAL

DESIGN AND SOFTWARE SIMULATION

18

DIGITAL RAILROAD CROSSING SIGNAL

Now, let’s develop a digital circuit whose output changes over time

We are all familiar with a railroad crossing signal that alternates flashing red lights

In addition to constructing the digital combination lock, so let’s begin by designing the circuit

19

RAILROAD CROSSING SIGNAL DESIGN

Here we will need some type of timing signal that will tell the lights when to turn on and off

The problem is that we seemingly need two timing signals since one light is on while the other is off, and vice versa

A digital logic implementation can allow us to save cost by using only a single timing signal

The design effort is then one of considering which gate(s) need to be used to achieve the alternating signal patterns

20

RAILROAD CROSSING SIGNAL

Turn-on voltage puts out a constant +5 volts

Square wave is being repeatedly

turned on then off

AND0/1

1

0/1

1/0

1 AND 0 outputs 01 AND 1 outputs 1

1 XOR 0 outputs 11 XOR 1 outputs 0

XOR

21

RAILROAD CROSSING SIGNAL SIMULATION

The “Railroad Xing Simulation” worksheet may be used in Excel to view (over time) the activation of the RR crossing lights

Note that this Excel simulation uses some advanced features of Excel such as iteration and conditional formatting to achieve the software simulation

ADDITIONAL READING

How to do Boolean Logic work. http://computer.howstuffworks.com/boolean.htm