Module-1 Part-1
Module-1 Part-1
Module-1 Part-1
(Number System)
1*20 + 1+
0*21 +
1*22 + 4+
0*23 +
0*24 +
1*25 32
3710
Binary to Decimal Conversion
Example 1 Convert binary 101112 to decimal
positional powers of 2: 24 23 22 21 20
decimal positional value: 16 8 4 2 1
Ans 101112 = 2310
binary number:
1 0 1 1 1
16 + 4 + 2 + 1 = 2310
Example 2 Convert binary 100112 to decimal
positional powers of 2: 2 4 23 22 21 20
decimal positional value: 16 8 4 2 1 Ans 100112 = 1910
binary number:
1 0 0 1 1
16 + +2 +1 =1910
Example 3: Convert binary 1100102 to decimal
positional powers of 2: 25 24 23 22 21 20
decimal positional value: 32 16 8 4 2 1
Ans 1100102 = 5010
binary number: 1 1 0 0 1 0
32+ 16 + 2 = 5010
1(b) Decimal to Binary Conversion
(i) Division Method
Decimal to Binary Conversion
The Division Method:
1) Start with your number (call it N) in base 10
2) Divide N by 2 and record the remainder
3) If (quotient = 0) then stop
else make the quotient your new N, and go back to step 2
The remainders comprise your answer, starting with the last remainder as your first
(leftmost) digit.
In other words, divide the decimal number by 2 until you reach zero, and then
collect the remainders in reverse.
Converting a decimal number to a number in base r
Ques. Convert decimal 41 to binary.
Solution:
First, 41 is divided by 2 to give an integer quotient of 20 and a remainder of 12
Then the quotient is again divided by 2 to give a new quotient and remainder.
The process is continued until the integer quotient becomes 0.
The coefficients of the desired binary number are obtained from the remainders
as follows:
Decimal to Binary Conversion
Example 2: Convert decimal 2210 to binary
Using the Division Method
2210 =
2 ) 22 Rem
2 ) 11 0
2) 5 1
Ans 2210 = 101102
2) 2 1
2) 1 0
01
Base: 8
Digits: 0, 1, 2, 3, 4, 5, 6, 7
Positional powers of 8: 8 2 81 80
Decimal positional value: 64 8 1
Octal number: 3 5 7
Value of 357 = (3 x 64) + (5 x 8) + (7 x 1)
= 192 + 40 + 7 = 23910
Positional powers of 8: 8 3 82 81 80
Decimal positional value: 512 64 8 1
Octal number: 1 2 4 6
Value of 12468 (1 x 512) + (2 x 64) + (4 x 8) + (6 x 1)
= 512 + 128 + 32 + 6 = 67810
Positional powers of 8: 8 3 82 81 80
Decimal positional value: 512 64 8 1
Octal number: 1 2 4 6
Value of 12468 (1 x 512) + (5 x 64) + (0 x 8) + (3 x 1)
= 512 + 320 + 0 + 3 = 83510
In other words, divide the decimal number by 16 until you reach zero, and then collect
the remainders in reverse.
Division Method:
12610 =
16) 126 Rem:
16) 7 14= E
0 7= 7 Answer: 12610 = 7E16
Decimal to Hex Conversion
Example 2: Convert decimal 60310 to Hexadecimal
Using The Division Method:
60310 =
16) 603 Rem:
16) 37 11=B
Ans. 60310 = 25B16
16) 2 5
0 2
So using 3 bits we can represent values from 0 to 7=8 Digits which are the digits of the Octal
numbering system.
101001102 = 2468
101001102 = 4468
5(a) Binary to Hex Conversion
Binary to Hex Conversion
The maximum value represented in 4 bit is: 24 – 1 = 15
So using 4 bits we can represent values 0 to 15=16 Digits which are the digits
of the Hexadecimal numbering system.
Thus, four binary digits can be converted to one hexadecimal digit.
1 1010 0110
0110 = 6
1010 = A
0001 = 1 (pad empty digits with 0)
11 1110 0110
0110 = 6
1110 = E
0011 = 3 (pad empty digits with 0)
Answers
Example
Ex-1
(1011.101)2 =(?)10
Ex-2
Conversion of Fractional Part
(N)10 (fractional)= (M)b (fractional)
Decimal to binary
• The procedure for converting this is to multiply (N)10 (fractional) by b.
• If the resulting product is less than 1, then the most significant (leftmost) digit of the
• fractional part is 0.
• If the resulting product is greater than 1, the most significant digit of the fractional part is
the integer part of the product.
• The next most significant digit is formed by multiplying the fractional part of this product
by b and taking the integer part.
• The remaining digits are formed by repeating this process.
• The process may or may not terminate.
In general,
• Consider the number of integer part of the resulting product
Conversion of Fractional Part
• Weighted
• Non-weighted
• 8 4 2 1 (Binary Coded Decimal)
Weighted: • 24 2 1
• Decimal • 8 4 -2 -1
• Other
• Binary
• Octal
• Hexadecimal
Non-Weighted:
• Gray Code [consecutive number differs by one bit]
• Excess-3 code [8421 CODE+3]
• ASCII code
Gray code
• The reflected binary code or Gray code is an ordering of the binary numeral system such
that two successive values differ in only one bit (binary digit).
• Gray codes are very useful in the normal sequence of binary numbers generated by the
hardware that may cause an error or ambiguity during the transition from one number to
the next.
ASCII code
• ASCII, stands for American Standard Code for Information
Interchange
• It's a 7-bit character code where every single bit represents a unique
character.
• ASCII is the most common character encoding format for text data
in computers and on the internet.