Esc201: Introducton To Electronics: Number System and Logic Gates
Esc201: Introducton To Electronics: Number System and Logic Gates
Esc201: Introducton To Electronics: Number System and Logic Gates
1
Numbers
5 4 3 2 1 0
(a5 a4 a3a2 a1a0 ) r a5 r a4 r a3r a2 r a1r a0 r
The decimal system has a base of 10 and uses symbols
(0,1,2,3,4,5,6,7,8,9) to represent numbers
3 2 1 0
(2009)10 2 10 0 10 0 10 9 10
2 1 0 1 2
(123.24)10 110 2 10 3 10 2 10 4 10
2
Numbers
3 2 1 0
(2007)8 2 8 0 8 0 8 7 8
1 0
(2007)8 2 512 0 64 0 8 7 8 1033
(2007)8 1033 10
3
Number Symbol
Numbers
0 0
1 1
A hexadecimal system has a base of 16
2 2
3 3
4 4
(2 BC 9)16 2 163 B 16 2 C 161 9 160
5 5
6 6
How do we convert it into decimal number? 7 7
1 8 8
(2 BC 9)16 2 4096 11256 12 16 9 9
9 160 11209 10 A
11 B
12 C
(2 BC 9)16 11209 10 13
14
D
E
15 F 4
A Binary system has a base 2 and uses only two symbols 0, 1
to represent all the numbers 2 1 0
3 2 1 0 21 2
(1101) 2 12 12 0 2 12
22 4
1 0 25 32
(1101) 2 18 14 0 2 12 13 26 64
27 128
1101.1001 28 256
2-4 29 512
23
-2 2-3
2 2
2 1
2 0
2-1 2 210 1024(K)
220 1048576(M)
13. 5625
2-1 2-2 2-3 2-4 2-5 2-6
11001 = ? 25
1100001 = ? 64+32+1=97
0.101 = ? 0.5+0.125=0.625
11.001 = ? 3+0.125=3.125
6
Converting decimal to binary number
Convert 45 to binary number
b0 1 7
22 0.5 bn 2 n 1
bn 1 2 ....... b1 2 b0 0.5 b0 1
n 2 0
n 1 n 2 1 0
22 bn 2 bn 1 2 ....... b2 2 b1 2
Divide both sides by 2
22 n 2 n 3 0
11 bn 2 bn 1 2 ....... b2 2 b1 0.5 b1 0
2
n 2 n 3 1 0
11 bn 2 bn 1 2 ...... b3 2 b2 2
n 4 n 5 1 0
2 bn 2 bn 1 2 ...... b5 2 b4 2
n 5 n 6 0
1 bn 2 bn 1 2 ...... b5 2 0.5b4 b4 0
b5 1
45 remainder
22 1
11 0
5 1 45 = 101101
2 1
1 0
0 1 44 = 101100
10
Converting decimal to binary number
Convert (0.35)10 to binary number
1 n 1
0.7 b 1 b 2 2 .......b n 2 b 1 0
1 2 n 1
0.7 b 2 2 b 3 2 .......b n 2
11
1 2 n 1
0.7 b 2 2 b 3 2 .......b n 2
Multiply both sides by 2
1
1.4 b 2 b 3 2 .......b n 2 n 2
b 2 1
Note that ½+1/4+1/8+……1
1 2 n 2
0.4 b 3 2 b 4 2 .......b n 2
1
0.8 b 3 b 4 2 .......b n 2 n 3 b 3 0
12
Converting decimal to binary number
0.125 = ?
0 . 125
x2
0. 25
x2
0. 5
0.125 = (.001)2 x2
1. 0
0 . 8125
0.8125 = ?
x2
1. 625
x2
1. 25
x2
0.8125 = (.1101)2 0. 5
x2
1. 0 13
decimal 2bit 3bit 4bit 5bit
Binary numbers
0 00 000 0000 00000
1 01 001 0001 00001
Most significant bit or MSB
2 10 010 0010 00010
101 1101
110 + 1110
1011 11011
15
Complement of a binary number
1’s complement
Binary system:
2’s complement
001110
1011 0101
101101100 010010100
17
Advantages of using 2’s complement
x1 S
Adder
x2 CY
Answer is -4
Representing positive and negative binary numbers
One extra bit is required to carry sign information. Sign bit = 0 represents positive
number and Sign bit = 1 represents negative number
decimal Signed decimal Signed 1’s decimal Signed 2’s
Magnitude complement complement
0 0000 -1 1110 -1 1111
1 0001 -2 1101 -2 1110
2 0010 -3 1100 -3 1101
3 0011 -4 1011 -4 1100
4 0100 -5 1010 -5 1011
5 0101 -6 1001 -6 1010
6 0110 -7 1000 -7 1001
7 0111
-0 1000
-1 1001
-2 1010
-3 1011
-4 1100
-5 1101
-6 1110
-7 1111 20
Example
0101 0101
+5 +0010 +5 +1110
+2 -2
0111 +3 0011
+7
1011 1011
-5 +0010 -5 +1110
+2 -2
-3 1101 -7 1001
0 0 0
0 1 1
1 0 1
1 1 1
x y
NOT: y = x
0 1
1 0
24
Boolean Algebra
Basic Postulates
P1.a: x + 0 = x P1.b: x . 1 = x Identity element
P2.a: x +y = y+x P2.b: x . y = y . x Commutative
Basic Theorems
T1.a: x + x = x T1.b: x . x = x
T2.a: x + 1 = 1
T2.b: x . 0 = 0
T3.a: ( x ) = x
T4.b: x . (y.z) = (x.y).z
T4.a: x + (y+z) = (x+y)+z
T5.b: (x.y) = x + y (DeMorgan
T5.a: (x+y) = x . y (DeMorgan's theorem)
T6.a: x+ x.y = x T6.b: x.( x+y) = x 25
Proving Theorems P1.a: x + 0 = x P1.b: x . 1 = x
P2.a: x + y = y + x P2.b: x . y = y . x
P3.a: x.(y+z) = x.y+x.z P3.b: x+y.z = (x+y).(x+z)
P4.a: x + x = 1 P4.b: x . x = 0
Prove : x + 1 = 1 x + x .y = x
x + 1 = x+(x+ x) = x . 1 + x. y
= x. (1+ y)
= (x+x)+ x
=x.1
=x+x =x
=1