Binary Drill … Solutions

Download Report

Transcript Binary Drill … Solutions

Digital Electronics
Chapter 1
Binary Systems
Digital Electronics Galore!
•Digital Cameras
•Digital Versatile Disks (DVD)
•Digital Computers
•Digital Televisions
•Digital Telephones
•Digital Birthday Cards
Binary Numbers
Decimal
7
5
8
3
103 102 101 100
Binary
1
1
0
1
23
22
21
20
Binary Drill
1101 = ?
1001 = ?
1010 = ?
1000 = ?
0101 = ?
Binary Drill … Solutions
1101 = 13
1001 = 9
1010 = 10
1000 = 8
0101 = 5
Hexadecimal (Base 16)
163 162 161 160
So 3816 = what in decimal?
Hexadecimal Solution
3816 = 5610
Decimal - Hexadecimal
0 through 9 = 0 through 9
10 = A
11 = B
12 = C
13 = D
14 = E
15 = F
16 = 10
17 = 11
18 = 12
Hexadecimal Drill
2B7 = what in decimal?
Hint: Think … 163 162 161 160
Hexadecimal Drill … Solution
Hint: Think … 163 162 161 160
2B7 = 256 x 2 + 16 x 11 + 7
2B716 = 69510
Hexadecimal To Binary
2B7 = what in binary?
Hint
Secret Recipe: Convert digit by digit!!!
Hex2Bin … Solution
2B7 = what in binary?
Secret Recipe: Convert digit by digit!!!
2 B 716 = 0010 1011 0111
Octal (Base 8)
83 82 81 80
So 658 = what in decimal?
Octal Solution
658 = 5310
Decimal - Octal
0=0
1=1
2=2
3=3
4=4
5=5
6=6
7=7
8 = 10
9 = 11
10 = 12
Octal Drill
2178 = what in decimal?
Hint: Think … 83 82 81 80
Octal Drill … Solution
Hint: Think … 83 82 81 80
2178 = 64 x 2 + 8 x 1 + 7
2178 = 14310
Octal To Binary
2178 = what in binary?
Hint : Groups of 3
Secret Recipe: Convert digit by digit!!!
Oct2Bin … Solution
217 = what in binary?
Secret Recipe: Convert digit by digit!!!
2 1 78 = 010 001 111
Fractions in Binary
23
22
21
20
.
2-1
2-2
21.75 = what in binary?
2 1.7510 = 10101. 11
2-3
Fractions … Drill
23
22
21
20
.
2-1
2-2
41.6875 = what in binary?
2-3
Fractions … Drill
23
22
21
20
.
2-1
2-2
41.687510 = 101001.1011
2-3
Complements
1’s complement is formed by inverting
the digits
1’s complement of 10010001 = 01101110
2’s complement is formed by adding 1
to the 1’s complement
2’s complement of 10010001 = 01101111
Negative (signed) Numbers
2’s complement is used to represent a
negative number
Example: 117 - 102
115 = 01110011 and 102 = 01100110
So -102 = 10011010
So 115 = 01110011
-102 = 10011010
13 = 00001101
BCD (Binary Coded Decimal)
Example
87510 = 1000 0111 0101
Note that each digit is coded individually.
Do not confuse this with pure binary!
ASCII Character Codes
CAPS:
A = 4116 = 1000001
G = 4716 = 1000010
Z = 5A16 = 1011010
lower case
a = 6116 = 1100001
h = 6816 = 0111000
z = 7A16 = 1111010
digits 0 -9
4 = 3416 = 0110100
8 = 3816 = 0111000
Error Detection and Parity
Parity bit is an extra bit added to make
the total number of 1’s even or odd
depending on the protocol agreed upon
A with even parity = 01000001
A with odd parity = 11000001
Parity bit helps in detecting errors
during transmission.
Binary Logic
AND means ALL conditions must be
TRUE for the outcome to be true. For
instance, you must study AND take the
test in order to pass this class.
OR means AT LEAST ONE condition
must be true for the outcome to be true.
For instance, you can walk, ride the
bike, or drive to get to school.
Logic Gates
AND
OR
x
y
x y
x
y
x+y
0
0
0
0
0
0
0
1
0
0
1
1
1
0
0
1
0
1
1
1
1
1
1
1
Digital Logic Gates
AND
OR
NOT
Timing Diagrams
That’s All Folks!