Documente Academic
Documente Profesional
Documente Cultură
http://www.electronicsteacher.com
1
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
2
Electrical Engineering
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
3
Electrical Engineering
5 Analog Waveform
Voltage (V)
Time
0
Digital Waveform
5
1 1
Voltage (V)
0 Time
0
4
Electrical Engineering
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 Operator
Truth Table
• AND means that both conditions
A B Output
must be true in order for the
0 0 0
conclusion to be true
0 1 0
1 0 0
1 1 1
5
Electrical Engineering
Digital AND
• We can build an electrical device that performs the logical AND operation on voltage equivalents of
logic values
6
Electrical Engineering
OR Operator
• Another basic operator is the OR
• Consider:
If I have cash OR a credit card,
then I can pay the bill OR Operator
Truth Table
• OR works such that the output is true,
if either of the two inputs is true A B Output
0 0 0
0 1 1
1 0 1
1 1 1
7
Electrical Engineering
NOT Operator/Inverter Gate
• The NOT gate reverses the input
A B
NOT Operator
Truth Table
• All digital computers are A B
built using only three gate 0 1
types: AND, OR, and NOT 1 0
8
Electrical Engineering
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
9
Electrical Engineering
Digital XOR
• We can build an electrical device that performs the logical XOR operation on voltage equivalents of logic
values
XOR Operator
Truth Table
A A B Output
Output
Inputs 0 0 0
B 0 1 1
1 0 1
1 1 0
10
Electrical Engineering
Digital Combination Lock
11
Multi-Input AND Gate
• AND gates can be built with any number of inputs
• Consider the symbol for the 4-input AND gate
A
B F
C
D
12
Electrical Engineering
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
1
AND 1
1 1
AND
1
AND 1
13
Electrical Engineering
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
0 1
14
Electrical Engineering
Digital Combination Lock
• Let’s build a combination lock whose input (key code)
combination is 0 1 1 0
0 1
AND 1
1 1
AND
1
AND 1
0 1
15
Electrical Engineering
“Picking” a Digital Lock
• Use the truth table below to record the lock outputs for the different lock combinations
in the “Pick the Locks” worksheet
Input
Combination Lock Output
A B C D Lock #1 Lock #2 Lock #3 Lock #4 Lock #5
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
16
Electrical Engineering
Digital Railroad Crossing Signal
17
Digital Railroad Crossing Signal
18
Electrical Engineering
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
19
Electrical Engineering
Railroad Crossing Signal
Turn-on voltage puts 1 AND 0 outputs 0
out a constant +5 volts 1 AND 1 outputs 1
0/1
AND
1
Square wave is
being repeatedly
turned on then off
0/1 XOR
1/0
1 XOR 0 outputs 1
1 XOR 1 outputs 0
20
Electrical Engineering
Railroad Crossing Signal Simulation
21
Electrical Engineering