digital systems - baltimore polytechnic institute...2014/11/04 · key trends ive come up with a...
TRANSCRIPT
Digital Systems
“We live in a digital world and I am a digital girl.”
REMINDER: students are responsible for all concepts referred to in student learn sheets.
Lecture Overview
Basic electricity 1
Binary number system
Computer trends 2
Analog and digital technology 3
4
Digital Logic 5
Key trends
“I’ve come up with a set of rules that describe our reactions to technologies:
1. Anything that is in the world when you’re born is normal and ordinary and is just a natural part of the way the world works.
2. Anything that’s invented between when you’re fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it.
3. Anything invented after you’re thirty-five is against the natural order of things.”
– Douglas Adams, author of The Hitchhiker’s Guide to the Galaxy
Electricity vs. Electronics
Electricity
– using electrons to transferring energy
Electronics
– using electrical signals to convert and process information
Electricity Vocabulary
• Circuit
• Voltage, current
• Resistor
• Switch
• Electromechanical relay
• Capacitor
Pictoral
Schematic
Vocabulary
• Circuit
• Voltage, current (DC/AC)
• Resistor
• Switch
• Electromechanical relay
• Capacitor
http://en.wikipedia.org/wiki/War_of_currents
Electricity
Vocabulary
• Circuit
• Voltage, current
• Resistor (Ohm’s, Watt’s laws)
• Switch
• Electromechanical relay
• Capacitor
Electricity
Vocabulary
• Circuit
• Voltage, current
• Resistor
• Switch
• Electromechanical relay
• Capacitor
Electricity
Vocabulary
• Circuit
• Voltage, current
• Resistor
• Switch
• Electromechanical relay
– Electromagnetism
• Capacitor
Electricity
Vocabulary
• Circuit
• Voltage, current
• Resistor
• Switch
• Electromechanical relay
• Capacitor
Electricity
Robot Car Schematic
Key trends • Mechanical Relay (1835)
– Joseph Henry, Samuel Morse
– overcame limited range of telegraph signal by allowing repetition
• Vacuum Tube (1904) – Inspired by the light bulb and first patented by Edison.
– Used as an amplifier, AC/DC converter, switch
• Transistor (1948) – Fundamental building block of modern electronics
– Solid state – electrons confined to solid material (e.g., no mechanical devices)
– Amplify and switch electronic signals and power
Key trends • Integrated circuit (1958)
– Large number of tiny transistors integrated on single chip
– Printed as a unit (photolithography), mass produced, minimal material
– Moore’s Law
• Microprocessor (1971) – Incorporates the functions of a CPU on a single IC
• Programmable; has internal memory
• Input, processing, output
– PCs use many for different functions
– Control in embedded systems
What’s the big deal?
• Why ICs?
1. Reliability – less prone to failure (solid state)
2. Size – single chips replaced entire boards
3. Speed – electricity has shorter distance to travel
4. Efficiency – smaller = less electrical power = less heat
5. Cost – mass production
Embedded systems • > 90% of world’s microprocessors are inside common
household and electronic devices.
• A microprocessor used as a component of a larger system is an embedded system.
• Examples: – Electronic thermostats
– Traffic lights
– Wristwatches
– Calculators
– Cameras
– Cars
– Ovens
– Etc.
• Almost anything powered by electricity…
Key trends
• Babbage’s analytical engine
• Atanasoff-Berry-Computer (ABC) and IBM
• Zuse’s Z1 and the Nazis
• Turing’s Colossus
• Mark I
• ENIAC
• Jack Kilby and the IC
• Intel 4004
• Personal Computers
• Integrated circuit
• Microprocessor
Student G-Doc
What everyday product is likely the biggest user of computers?
Car may have over 50 computers
Digital Systems
Part 10
“We live in a digital world and I am a digital girl.”
Electricity vs. Electronics
Electricity
– using electrons to transferring energy
Electronics
– using electrical signals to convert and process information
• Phonograph record—wiggles in grooves to represent sound oscillations
• Mercury thermometers
• Vinyl records
• Slide rule—an instrument which does
multiplication by adding lengths which correspond to the logarithms of numbers.
Analog Devices
Analog processes
What do these items have in common?
1. Continuous signal.
2. Has infinite resolution (theoretically).
3. Uses some property of the medium to convey the signal information.
4. Noise.
Analog processes
• How tall are you?
• How many M&M’s have you ever eaten?
• What color is the car you most ride in?
• How many shades of red can you see?
• What’s the temperature outside?
• What’s your body temperature?
• What time is it?
Example of Analog Signals
• An analog signal can be any time-varying signal.
• Minimum and maximum values can be either positive or negative.
• They can be periodic (repeating) or non-periodic.
• Sine waves and square waves are two common analog signals.
• Note that this square wave is not a digital signal because its
minimum value is negative.
24
0 volts
Sine Wave Square Wave (not digital)
Random-Periodic
Digital processes What do these items have in common?
1. Discrete bands of analog signal.
2. Easier to get a device to switch into a number of known states.
3. No noise.
Digital processes
• Are you over 6’ tall?
• Are you an only child?
• Is the car you most ride in blue?
• Is it above freezing outside?
• Is it before 11am?
• Any question can be answered as a series of yes or no questions.
Logic Levels Before examining digital signals, we must define logic levels.
A logic level is a voltage level that represents a defined
digital state.
Logic HIGH: The higher of two voltages, typically 5 volts
Logic LOW: The lower of two voltages, typically 0 volts
27
5.0 v
2.0 v
0.8 v
0.0 v Logic Low
Logic High
Invalid Logic Level
Logic Level Voltage True/False On/Off 0/1
HIGH 5 volts True On 1
LOW 0 volts False Off 0
ADC
• The world happens in analog
• Analog data (measured)
• ADC = analog to digital converter
– Digital data (counted)
– ADC = digitization = sampling
– Sample rate – time interval of samples (x-axis)
– Sample precision – number of discrete digital values that can be represented (y-axis)
Conversion • CD music is encoded as 44.1
kHz, 16 bit audio.
– The music is sampled ('sliced‘) 44,100 times a second.
– 16 bit means the precision (height range) is 65,536 different values for each sample.
• The finer the grid, the better the digital representation.
[44,100 samples/channel/second x 2 bytes/sample x 2 channels x 74 minutes x 60 seconds/minute = 783,216,000 bytes]
To recreate an analog signal, need good digitization.
Computer components
PROCESSOR
STORAGE
OUTPUT INPUT
Bridging the Digital Divide
Binary-to-Decimal Conversion
Decimal-to-Binary
Conversion
32
Decimal vs. Binary
• Decimal number system – base 10
– 10 digits possible:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
– Placeholders are powers of 10
– 10 possible digits:
… 107 106 105 104 103 102 101 100
Decimal vs. Binary
• Binary number system (bin) – base 2
– 2 digits possible:
0, 1
– Placeholders are powers of 2
– 10 possible digits:
… 27 26 25 24 23 22 21 20
Decimal ‒to‒ Binary Conversion
The Process : Successive Division
a) Divide the Decimal Number by 2; the remainder is the LSB of
Binary Number .
b) If the quotation is zero, the conversion is complete; else repeat
step (a) using the quotation as the Decimal Number. The new
remainder is the next most significant bit of the Binary Number.
Example:
Convert the decimal number 610 into its binary equivalent.
Bit tSignifican Most 1 r 0 1 2
1 r 1 3 2
Bit tSignifican Least 0 r 3 6 2
610 = 1102
35
Dec → Binary : Example #1 Example:
Convert the decimal number 2610 into its binary equivalent.
36
Dec → Binary : Example #1 Example:
Convert the decimal number 2610 into its binary equivalent.
Solution:
LSB 0 r 13 26 2
MSB 1 r 0 1 2
1 r 6 13 2
0 r 3 6 2
1 r 1 3 2
2610 = 110102
37
Dec → Binary : Example #2 Example:
Convert the decimal number 4110 into its binary equivalent.
38
Dec → Binary : Example #2 Example:
Convert the decimal number 4110 into its binary equivalent.
Solution:
LSB 1 r 20 41 2
0 r 10 20 2
0 r 5 10 2
1 r 2 5 2
4110 = 1010012
MSB 1 r 0 1 2
0 r 1 2 2
39
Binary ‒to‒ Decimal Process
The Process : Weighted Multiplication
a) Multiply each bit of the Binary Number by it corresponding bit-
weighting factor (i.e. Bit-0→20=1; Bit-1→21=2; Bit-2→22=4; etc).
b) Sum up all the products in step (a) to get the Decimal Number.
Example:
Convert the decimal number 01102 into its decimal equivalent.
0110 2 = 6 10
0 1 1 0
23 22 21 20
8 4 2 1
0 + 4 + 2 + 0 = 610
Bit-Weighting Factors
40
Binary → Dec : Example #1 Example:
Convert the binary number 100102 into its decimal equivalent.
41
Binary → Dec : Example #1 Example:
Convert the binary number 100102 into its decimal equivalent.
100102 = 1810
1 0 0 1 0
24 23 22 21 20
16 8 4 2 1
16 + 0 + 0 + 2 + 0 = 1810
Solution:
42
Binary number system • Let’s count:
1
2
3
4
5
6
7
8
9
10
There are 10 types of people in the world:
Those who understand binary and those who don’t.
Binary number system
• How many bits are in a byte?
• How many binary numbers in a bit?
• How many binary numbers in a byte?
ASCII vs. Unicode
Other number systems
• Binary (bin) – 0, 1
– on/off
• Octal (oct) – 0, 1, 2, 3, 4, 5, 6, 7
– 1/3 length of binary #
– 3 bits into 1 octal digit
• Hexadecimal (hex) – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
– ¼ length of binary #
– 16 bits into 1 hexadecimal digit
• Decimal – 10 not a power of 2
• All capable of representing any number
• Conversions between systems possible without any loss of value
Binary to Octal
• Group bits in binary # in groups of 3, then convert each group:
1 1 1 0 0 1 0 1
0 1 1 1 0 0 1 0 1
3 4 5
111001012 = 3458
Binary to Hexadecimal
• Group bits in binary # in groups of 4, then convert each group:
1 1 1 0 0 1 0 1
1 1 1 0 0 1 0 1
E 5
111001012 = E516
Binary to Hex
• A byte is tough to represent with oct.
• Easier with hex.
1 0 0 0 1 0 0 1
Digital Systems
Part 11
“We live in a digital world and I am a digital girl.”
Basis for digital computers
• George Boole (1854) linked arithmetic, logic, bin – showed how bin simplifies complex logic probs.
• The true-false nature of Boolean logic makes it compatible with binary logic used in digital computers.
• Electronic circuits can produce Boolean logic operations – Claude Shannon (1938)
• Logic circuits are called gates.
– NOT
– AND
– OR
Logic Gates
• Go over NOT, AND, OR, NOR, NAND, XOR here.
• Gate diagram, truth table, sentence symbol.
BOARD
Logic Gates NOT
The simplest possible gate is called an "inverter," or a NOT gate.
One bit as input produces its opposite as output.
The symbol for a NOT gate in circuit diagrams is shown below.
The logic table, or truth table for the NOT gate shows input and output.
A BOARD
Logic Gates AND
The AND gate has the following symbol and logic table.
Two or more input bits produce one output bit.
Both inputs must be true (1) for the output to be true.
Otherwise the output is false (0).
A.B BOARD
Logic Gates OR
• The OR gate has the following symbol and logic table. • Two or more input bits produce one output bit. • Either inputs must be true (1) for the output to be true.
A+B BOARD
NAND is a NOT and
an AND gate.
A B Q
0 0 0
0 1 0
1 0 0
1 1 1
Not
A B Q'
0 0 1
0 1 1
1 0 1
1 1 0
Tying inputs together
• What do you suppose the truth table looks
like for this guy?
Digital electronics make logic decisions (use Venn diagrams, truth tables, logic circuits)
1. You have a fire alarm installed in your house which will sound if it senses heat or smoke.
2. You have a buzzer in your car that sounds when your keys are in the ignition and the door is open, or if your seat belt is not fastened.
3. People can vote if they are a citizen, are 18 and are registered.
4. George is elected chairman only if he gets majority of 3 votes.
5. You can go to the R movie if you have $10 and if you are over 18 or accompanied by a parent.
BOARD
Truth Tables & Logic Expressions Given design specifications (i.e., word problem) create a Truth Table
and Write SOP logic Expression
X Y OUT
0 0 0
0 1 0
1 0 1
1 1 0
EQUALS EQUALS
Design Specifications
Truth Table
Y XOUT
Logic Expression
EQUALS End
Product
B. Constructing A Truth Table (Example 1)
• A truth table shows how a logic design’s output
respond to ALL combinations of possible inputs.
• A logic design with N inputs will have 2N input
combinations.
Input 1 Input 2 Output
2 Inputs Input 1 Input 2 Input 3 Output
3 Inputs
0
0
0
1
0
1
0
1
0
0
1
1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
1
0
0
0
1
1
All possibilities (This is known for all Truth Tables)
66
1. Construct a Truth Table-2 Inputs (example #2)
Create a truth table to represent this situation:
I want to pick all girls in the class who have glasses.
The “truth” or how you get “picked” is to be a girl AND to
have glasses.
0
0
0
1
Step 1) How many Inputs? = 2 (Girls & Glasses)
Step 2) 2N = 22 = 4 I/P combinations Step 3) Create Truth Table with 3 Columns
Input 1 GIRL
Input 2 GLASSES
Output
Girls with Glasses
Step 4) Label Input 1 & Input 2 Step 5) Label Output Step 6) Fill in 0s & 1s --- All possible solutions
0 0
0 1
1 0
1 1 Step 7) Fill in Outputs * This is an “AND” problem * We only care when Girl “AND” Glasses are True or “1”
67
Combine gates.
• Gates can (obviously, now) be combined.
• The output of one gate can become the input of another.
• Try to determine the logic sentences and tables for these circuits.
Construct the logic sentences and tables for these circuits.
3. Control systems: e.g., car will start only if doors are locked, seat belts are on, key is turned D S K I 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1
How could we state the conditions that generate the desired output?
3. Control systems: e.g., car will start only if doors are locked, seat belts are on, key is turned D S K I 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
I = D AND S AND K
How could we state the conditions that generate the desired output?
Can you draw the diagram for the above logic statement?
Digital electronics make logic
decisions.
• A fire alarm sounds if it senses heat or smoke.
• You can go to the movie if you have $10 and if you can find a ride to
the theater.
• People can vote if they are a citizen, are 18 and are registered.
How does a computer handle this?
• A fire alarm sounds if it senses heat or smoke.
– Two conditions - heat OR smoke.
– One action - sound the alarm
heat smoke alarm
no no no
yes no yes
no yes yes
yes yes yes
heat smoke alarm
0 0 0
1 0 1
0 1 1
1 1 1
yes = 1
no = 0
Truth table for going to a movie.
• You can go to the movie if you have $10 and you have a ride.
– Two conditions - $10 AND ride.
– One action – see movie
Have $10 Have ride Go movie
no no no
yes no no
no yes no
yes yes yes
Hav $10 Have ride Go movie
0 0 0
1 0 0
0 1 0
1 1 1
Make a truth table for voting. • People can vote if they are a citizen, are 18 and are registered.
Citizen
18 years
old
Registered
to vote Vote
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
All computations...
• The most sophisticated computer can be made with NAND gates from Radio Shack.
• Need millions of them.
BOARD
References
Lectures and notes from Michael Karweit, JHU
Mr. Mick Scott, Instructor, EI
Beekman and Beekman – Digital Planet: Tomorrow’s Technology and You
Shelly – Discovering Computers 2011
http://www.robotroom.com/NumberSystems.html
Wikipedia
Background knowledge of basic electronics
http://logic.ly/demo/
www.jhu.edu/~virtlab/virtlab.html