Similar presentations:
Digital Logic Tutorial and Design
1.
Digital Logic Tutorial and Designhttp://www.electronicsteacher.com
1
2. Digital Logic Lab (A mini-lab experience)
• We are going to build both a combination lock and aflashing 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
Electrical Engineering
2
3. Some Definitions
• Definition: Discrete System - a system with a finitenumber 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
Electrical Engineering
3
4.
Analog WaveformVoltage (V)
5
Time
0
Digital Waveform
5
1
Voltage (V)
1
0
Time
0
Electrical Engineering
4
5. AND Operator
• Let’s look at the relationship between the semantic andlogical 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
Electrical Engineering
5
6. Digital AND
• We can build an electrical device that performs the logicalAND operation on voltage equivalents of logic values
• An AND gate has the
electrical schematic:
A
Inputs
Output
B
For digital logic:
True = 1 is 5 volts
False = 0 is 0 volts
• Practice with the Excel spreadsheet
Electrical Engineering
6
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
Electrical Engineering
OR Operator
Truth Table
A B Output
0 0 0
0 1 1
1 0 1
1 1 1
7
8. NOT Operator/Inverter Gate
• The NOT gate reverses the inputA
B
NOT Operator
Truth Table
• All digital computers are
built using only three gate
types: AND, OR, and NOT
Electrical Engineering
A B
0 1
1 0
8
9. XOR (Exclusive OR) Operator
• Let’s look at the relationship between the semantic andlogical 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
Electrical Engineering
9
10. Digital XOR
• We can build an electrical device that performs the logicalXOR operation on voltage equivalents of logic values
• An XOR gate has the
electrical schematic:
A
Inputs
B
Electrical Engineering
Output
XOR Operator
Truth Table
A B Output
0 0 0
0 1 1
1 0 1
1 1 0
10
11. Digital Combination Lock
Design and Software Simulation11
12. 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
C
D
F
• F is true only when all the inputs are true (1’s)
• Using the Excel workbook “EE-WISE-DigitalLab”, open
the “Digital Locks” worksheet, and test this circuit
Electrical Engineering
12
13. Digital Combination Lock
• Using 3 two-input AND gates, we could build a combinationlock that requires a four-digit code, specifically: 1 1 1 1
1
AND
1
1
AND
1
1
AND
1
1
• The number of inputs could be increased by using more and
more AND gates
Electrical Engineering
13
14. Digital Combination Lock
• We could build a combination lock that only uses the ANDgate, 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
Electrical Engineering
1
14
15. Digital Combination Lock
• Let’s build a combination lock whose input (key code)combination is 0 1 1 0
0
1
AND
1
1
AND
1
1
AND
0
1
1
• Is there any other combination that works?
Electrical Engineering
15
16. “Picking” a Digital Lock
• Use the truth table below to record the lock outputs forthe different lock combinations in the “Pick the Locks”
Input
worksheet
Electrical Engineering
Combination
A B C D
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
Lock #1
Lock Output
Lock #2 Lock #3 Lock #4
Lock #5
16
17. Digital Railroad Crossing Signal
Design and Software Simulation17
18. Digital Railroad Crossing Signal
• Now, let’s develop a digital circuit whose output changesover time
• We are all familiar with a railroad crossing signal that
alternates flashing red lights
• In addition to constructing the digital combination lock, we
will build the railroad crossing signal in the lab, so let’s
begin by designing the circuit
Electrical Engineering
18
19. Railroad Crossing Signal Design
• Here we will need some type of timing signal that will tellthe 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
Electrical Engineering
19
20. Railroad Crossing Signal
Turn-on voltage putsout a constant +5 volts
1 AND 0 outputs 0
1 AND 1 outputs 1
0/1
1
AND
Square wave is
being repeatedly
turned on then off
0/1
XOR
1/0
1 XOR 0 outputs 1
1 XOR 1 outputs 0
Electrical Engineering
20
21. Railroad Crossing Signal Simulation
• The “Railroad Xing Simulation” worksheet may be usedin 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
Electrical Engineering
21