Professional Documents
Culture Documents
2
Analog and Digital Signal
• Analog system
• The physical quantities or signals may vary continuously over a specified
range, take any shape and represent an infinite number of possible values
(e.g. temperature, pressure, distance, resistance, current etc.)
• Digital system
• The physical quantities or signals can assume only defined, discrete set
of possible values – usually only two (e.g. round number)
• Greater accuracy
X(t) X(t)
t t
Analog signal Digital signal
The Digital Revolution
• In recent years, many types of devices have been converted
from analog to digital.
• Examples:
Analog Digital
Music cassette CDs
VHS tapes DVDs
Analog television Digital TV
CD drive
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Ones (“1”) and Zeros (“0”)
• Digital devices (computers, iPods, cell phones, …) store
information (numbers, text, images, music, …) as strings of 1s
and 0s.
• Each 1 or 0 in such a string is called a bit (short for binary
digit).
• Example of an 8-bit word: 01101100
• A typical song in an MP3 file might contain 40 million bits.
Common Number Systems
Used by Used in
System Base Symbols humans? computers?
Decimal 10 0, 1, … 9 Yes No
Binary 2 0, 1 No Yes
Octal 8 0, 1, … 7 No No
Hexadecimal 16 0, 1, … 9, No No
A, B, … F
Decimal Number System
• Base (also called radix) = 10 2 1 0 -1 -2
• 10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
• Digit Position
5 1 2 7 4
• Integer & fraction
100 10 1 0.1 0.01
• Digit Weight
Position
• Weight = (Base)
• Magnitude
• Sum of “Digit x Weight” 500 10 2 0.7 0.04
• Formal Notation d2*B2+d1*B1+d0*B0+d-1*B-1+d-2*B-2
(512.74)10
Binary Inputs and Outputs
• A single binary input can only have two values:
True or False (Yes or No) (1 or 0)
9
Binary Inputs and Outputs
• More bits = more combinations
00 01 10 1 1
…25 24 23 22 21 20
11
Binary numbers
Decimal Binary
• A binary counting sequence for Number Number
n 2n n 2n
0 20=1 8 28=256
1 21=2 9 29=512
2 22=4 10 210=1024 Kilo
3 23=8 11 211=2048
4 24=16 12 212=4096
5 25=32 20 220=1M Mega
• The possibilities:
Decimal Octal
Binary Hexadecimal
Decimal, Binary, Octal and Hexadecimal
Decimal Binary Octal Hex
00 0000 00 0
01 0001 01 1
02 0010 02 2
03 0011 03 3
04 0100 04 4
05 0101 05 5
06 0110 06 6
07 0111 07 7
08 1000 10 8
09 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
Decimal to Binary
12510 = ?2 2 125
2 62 1
2 31 0
15 1
2
7 1
2
2 3 1
2 1 1
0 1
12510 = 11111012
Fractions (decimal to binary)
.14579
x 2
3.14579 0.29158
x 2
0.58316
x 2
1.16632
x 2
0.33264
x 2
0.66528
x 2
1.33056
11.001001...
etc.
Binary to Decimal
1010112 => 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310
Hexadecimal to Decimal
ABC16 => C x 160 = 12 x 1 = 12
B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810
Hexadecimal Number (Fraction) to Decimal
• Base = 16
• 16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
• Weights 256 16 1 1/16 1/256
Position
• Weight = (Base)
• Magnitude 1 E 5 7 A
• Sum of “Digit x Weight”
2 1 0 -1 -2
• Formal Notation
1 *162+14 *161+5 *160+7 *16-1+10 *16-2
(1E5.7A)16 =(485.4765625)10
Octal Number (Fraction) to decimal
• Base = 8
• 8 digits { 0, 1, 2, 3, 4, 5, 6, 7 }
• Weights
Position
• Weight = (Base)
• Magnitude
• Sum of “Digit x Weight”
• Formal Notation
64 8 1 1/8 1/64
5 1 2 7 4
2 1 0 -1 -2
2 1 0 -1 -
5
2 *8 +1 *8 +2 *8 +7 *8 +4 *8
=(330.9375)10
(512.74)8
Octal to Binary
7058 = ?2
7 0 5
7058 = 1110001012
Hexadecimal to Binary
10AF16 = ?2
1 0 A F
10AF16 = 00010000101011112
Binary − Hexadecimal Conversion
Hex Binary
• 16 =24 0 0000
• Each group of 4 bits represents a 1 0001
hexadecimal digit 2 0010
3 0011
4 0100
5 0101
Example: Assume Zeros
6 0110
7 0111
( 1 0 1 1 0 . 0 1 )2 8 1000
9 1001
A 1010
B 1011
C 1100
(1 6 . 4 )16 D 1101
E 1110
F 1111
Works both ways (Binary to Hex & Hex to
Binary)
Binary to Hexadecimal
10101110112 = ?16
10 1011 1011
2 B B
10101110112 = 2BB16
Binary Addition
1 1
10101 21
+ 11001 + 25
101110 46
Binary Subtraction
•.
29
And a full example
30
Two’s compliment
31
1’s Complement
32
2’s complement
33
Operation with 2’s complement
• Add 4 and -6
• Will use the 2’s complement of -6 or 1010
• 4 0100
• -6 1010
• 1110 (final carrier=0)
• And taking the 2’s complement of 1110 get 0001 + 1 = 0010
34
Signed Binary Numbers
Multiplication of binary
• Binary, two 1-bit values
A B AB
0 0 0
0 1 0
1 0 0
1 1 1
Multiplication of binary
• Binary, two n-bit values
• As with decimal values
• E.g.,
1110
x 1011
1110
1110
0000
1110
10011010
Division of binary
38
Logic Gates (AND, OR, NOT)
• Graphic Symbols and Input-Output Signals for Logic gates:
40
Logic Gates
41
Logic Gates (multiple inputs)
• Gates can have multiple inputs and more than
one output.
• A second output can be provided for the
complement of the operation.
42
Boolean Algebra
• The main thing to remember is that combinations
of gates implement Boolean functions.
• The circuit below implements the Boolean
function:
43
Basic Properties
• Commutative • Commutative
• X+Y=Y+X • X · Y=Y · X
• Associative • Associative
• X+(Y+Z)=(X+Y)+Z • X(YZ) = (XY)Z
• Distributive • Distributive
• X(Y+Z) =XY+XZ • X+YZ=(X+Y)(X+Z)
• AND distributes over OR • OR distributes over AND
44
Basic Properties
• DeMorgan’s Theorem
• Very important in simplifying equations
• (X + Y)’ = X’ · Y’
• (XY)’ = X’ + Y’
45
Simplify
• These properties (Laws and Theorems) can be used to
simplify equations to their simplest form.
• Simplify F=X’YZ+X’YZ’+XZ
46