Professional Documents
Culture Documents
Chapter Two
Number System and Codes
Topics covered:
Course outline and schedule
Introduction
Data Types
2
Cont…
3
Cont…
4
Cont…
5
Conversion Of Number System
The right most bit is called Least Significant Bit (LSB) and
left Most Bit is called Most Significant Bit (MSB).
ie., 100111
MSB LSB
1. Conversion from Binary to Decimal
The binary number system have a base 2, the position
weights are used on the power of 2.
Ex: 100111 = ?
1 x 25 + 0x 24 + 0x 23 + 1x22 + 1x21 + 1x20
1 x 32 + 0x 16 + 0x 8 + 1x4 + 1x2 + 1x1 = 39
100111 = 39 Ans.
6
Cont…
7
Cont…
8
Cont…
9
Cont…
10
Con..
11
Con…
12
Con…
13
BINARY ARITHMETIC
14
Cont…
The last case occurs when the two binary digits in a certain
position are 1s and there is a carry from the previous position.
Example1:
6+7 =13
110+111=1101
Binary Subtraction
It operates by the same rule as decimal subtraction. The rule is as
follows;
0-0=0 1-0=1 1-1=0 10-1=1
Example:
11100 28 101101 45
- 11010 -26 - 111 -7
00010 =2 100110 =38
15
Cont…
Binary Multiplication
Multiplication in binary is similar to its decimal counterpart. Two
numbers A and B can be multiplied by partial products: for each
digit in B, the product of that digit in A is calculated and written
on a new line, shifted leftward so that its rightmost digit lines
up with the digit in B that was used. The sum of all these partial
products gives the final result.
Since there are only two digits in binary, there are only two
possible outcomes of each partial multiplication:
• If the digit in B is 0, the partial product is also 0
• If the digit in B is 1, the partial product is equal to A
• For example, the binary numbers 1011 and 1010 are multiplied as
follows:
16
Representation Of Negative Numbers
17
1’s complement
18
2’s Complement
19
Coding Methods
20
Cont…
21
Cont…
Example:
character Zone Digit
A 1100 0001
a 1000 0001
9 1111 1001
22
Cont…
23
Cont…
Example:
24
Cont…
25
Cont…
26
Cont…
Character zone (4 BIT) digit (4 BIT)
0-9 3 0-9
A-O 4 1-15
P-Z 5 0-10
a-o 6 1-15
p-z 7 0-10
Example:
Character zone (4 BIT) digit (4 BIT)
a 0110 0-9
b 0110 1-15
A 0100 0-10
B 0100 1-15
27
The End!!
28