Computer learning 2
Computer learning 2
communication, measurement
- Reliable, Integration
• Analog – Continuous
- Natural Phenomena
(Pressure, Temperature, Speed…)
- Difficulty in realizing, processing using electronics
• Digital – Discrete
- Binary Digit ➔ Signal Processing as Bit unit
- Easy in realizing, processing using electronics
- High performance due to Integrated Circuit Technology
Binary Digit?
• Combinational Circuit :
• Base N
• N Digits: 0, 1, 2, 3, 4, 5, …, N-1
• Example: 1045N
• Positional Number System
n −1 4 3 2 1 0
N N N N N N
d n −1 d 4 d3 d 2 d1 d 0
• Digit do is the least significant digit (LSD).
• Digit dn-1 is the most significant digit (MSD).
7
Decimal Number System
• Base 10
• Ten Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
• Example: 104510
• Positional Number System
n −1 4 3 2 1 0
10 10 10 10 10 10
d n −1 d 4 d3 d 2 d1 d 0
• Digit d0 is the least significant digit (LSD).
• Digit dn-1 is the most significant digit (MSD).
8
Binary Number System
• Base 2
• Two Digits: 0, 1
• Example: 10101102
• Positional Number System
n −1 4 3 2 1 0
2 2 22 22
bn −1 b4 b3 b2 b1 b0
• Binary Digits are called Bits
• Bit bo is the least significant bit (LSB).
• Bit bn-1 is the most significant bit (MSB). 9
Octal Number System
• Base 8
• Ten Digits: 0, 1, 2, 3, 4, 5, 6, 7
• Example: 10458
• Positional Number System
8n-1 … 84 83 82 81 80
10
Hexadecimal Number System
• Base 16
• Sixteen Digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
• Example: EF5616
• Positional Number System
n−1 4 3 2 1 0
16 16 16 16 16 16
0000 0 0100 4 1000 8 1100 C
0001 1 0101 5 1001 9 1101 D
0010 2 0110 6 1010 A 1110 E
0011 3 0111 7 1011 B 1111 F
11
Number systems
include decimal, binary, octal and hexadecimal
13
Decimal to Binary Conversion
Method I:
20 21 22 23 24 25 26 27 28 29 210 2n
Exponent: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 , n
Decimal to Binary Conversion
Suppose x = 156410
Subtract 1024: 1564-1024 (210) = 540 n=10 or 1 in the (210)’s position
Subtract 512: 540-512 (29) = 28 n=9 or 1 in the (29)’s position
28=256, 27=128, 26=64, 25=32 > 28, so we have 0 in all of these positions
Subtract 16: 28-16 (24) = 12 n=4 or 1 in (24)’s position
Subtract 8: 12 – 8 (23) = 4 n=3 or 1 in (23)’s position
Subtract 4: 4 – 4 (22) = 0 n=2 or 1 in (22)’s position
Thus:
20 21 22 23 24 25 26 27 28 29 210
0 0 1 1 1 0 0 0 0 1 1
156410 = (1 1 0 0 0 0 1 1 1 0 0)2
Decimal to Binary Conversion
Method II:
Use repeated division by radix.
2 | 1564 2|__24_
782
2|_____ R=0 12
2|_____ R=0
391
2|_____ R=0 6
2|_____ R=0
195
2|_____ R=1 3
2|_____ R= 0
97
2|____ R=1 1
2|_____ R=1
48
2|_____ R=1 0 R=1
24 R=0
Collect remainders in reverse order
11000011100
Example 2: Decimal to Binary Conversion
2 53
2 26 rem. = 1 = a0
2 13 rem. = 0 = a1
5310 = 1101012
2 6 rem. = 1 = a2
rem. = 0 = a3
2 3
rem. = 1 = a4
2 1
rem. = 1 = a5
0
Example: Convert 0.7 to binary
.7
2
(1).4
2
(0).8
2
(1).6
2
(1).2
2
(0).4 Process starts repeating here because .4 was previously
obtained
2
(0).8 0.710 − 0.1 0110 0110 0110 2
Decimal to Octal Conversion
44978 / 8 5622 2
5622 / 8 702 6
702/8 87 6
87/8 10 7
10/8 1 2
1/8 0 1
4497810 = 1276628
Decimal to Hex Conversion
16 | 1564
97
16|_____ R = 12 = C
6
16|_____ R=1
0 R=6
N = 61C 16
Binary to Decimal Conversion
28 27 26 25 24 23 22 21 20
256 128 + 64 32 16 8 + 4 2 1
1 1 0 0 1 1 0 0
Binary to Octal Conversion
011000011100
30348
Binary to Hex Conversion
011000011100
61C16
Octal to Binary Conversion Example
24
Hexadecimal to Binary Conversion Example
(1 E 9 C)16
25
Conversion of Binary to Octal, Hexa-decimal
• (101011010111 )2
=( )8, octal
• (10111011)2
=( )8, octal
• (1010111100100101)2
=( )16, Hexadecimal
• (1101101000)2
=( )16, Hexadecimal