Professional Documents
Culture Documents
Bit:
The word bit is short for binary digit. A bit consists of one of two values, 0 or 1. A bit is a
smallest unit of data in a computer.
Byte:
A byte also happens to be how many bits are needed to present letters of the alphabet and
other characters. There are eight bits in a byte i.e. “A” would be 01000001.
Number system:
A number system is used for a set of different symbols or digits which represent numerical
values.
It contains 8 bits
Starting form 0 ----- 7
So, base of octal numbers is 8
It contains 16 digits
These are starting from “0” and ends on 15
The number 10, 11, 12, 13, 14, 15 are represented by A, B, C, D, E, F respectively
That’s why base of hexadecimal number is 16
It is required in assembly language programming
CONVERSION
There are about 12 conversions because we can convert each number system in other
number system.
EXAMPLES
1. DECIMAL TO BINARY
2 44 - 0
2 22 - 0
2 11 - 0
2 5 -1
2 2 -1
1 -0
(1011000)2
OR
2 88
2 44 - 0
2 22 - 0
2 11 - 0
2 5 -1
2 2 -1
2 1 -0
0 -1
(01011000)2
2. DECIMAL TO OCTAL
8 14 -7
1 -6
(167)8
3. DECIMAL TO HEXADECIMAL
16 185
16 11 -9
(B9)16
Multiply the fraction part of decimal number with the base of the system
in which fraction is to be converted.
The result may have two parts i.e. integer part and fraction part.
Multiply the resulting fraction with the base again.
Repeat minimum 5 steps.
The integral part is written as answer, from top to bottom.
EXAMPLES
DECIMAL TO BINARY
(0.56) ----- (?)2
Result Fractional Part Integral
(.10001)2
DECIMAL TO OCTAL
(0.3)10 ---------------- (?)8
0.3*8 2.4 .4 2
0.4*8 3.2 .2 3
0.2*8 1.6 .6 1
0.6*8 4.8 .8 4
0.8*8 6.4 .4 6
(.23146) 8
DECIMAL TO HEXADECIMAL
(0.3)10 ---------------- (?)16
0.3*16 4.8 .8 4
(.4CC) 16
Converting Decimal (Integral & Fractional part) To Other
Number System
Examples
Convert 88.56 into binary?
1 -0
(1011000)2 (.10001)2
(1011000.10001)2
0.8*8 6.4 .4 6
(167) 8 (.23146)8
(167.23146)8
(B9)16 (4CC)16
(B9.4CC) 16
4. Binary to Decimal
11001= 1*24+1*23+0*22+0*21+1*20
= 16+8+1
= 25
(25)10
5. Octal to Decimal
140= 1*82+4*81+0*80
= 64+32+0
= 96
(96)10
6. Hexadecimal to Decimal
5C= 5*161+C*160
= 5*161+12*160
= 80+12
= 92
(92)10
Table for 3 bits & 4 bits
8 4 2 1 Number
0 0 0 0 0
0 0 0 1 1
0 0 1 0 2
0 0 1 1 3
0 1 0 0 4
0 1 0 1 5
0 1 1 0 6
0 1 1 1 7
1 0 0 0 8
1 0 0 1 9
1 0 1 0 10=A
1 0 1 1 11=B
1 1 0 0 12=C
1 1 0 1 13=D
1 1 1 0 14=E
1 1 1 1 15=F
7. Binary to Octal
100= 1*22+0*21+0*20 = 4
= (456)8
4 5 6 (from table)
(456)8
8. Binary to Hexadecimal
2 C 6 B (from table)
(2C6B)16
Or
0010= 0*23+0*22+1*21+0*20 = 2
9. Octal to Binary
(456)8 = (?)2
4 5 6
(456)8 = (100101110)2
(456)8= (?)16
4 5 6
0001 0010 1110 ( make groups of 4 bits and write equivalent number from table )
1 2 E
= (12E)16
11. Hexadecimal to Binary
Take number
Write binary code for each number (4 bits)
It is the result
(2C6B)16 = (?)2
2 C 6 B
(from table)
Take number
Write binary equivalent (4 bits)
Make groups of 3 bits
Change in octal number
(12E)16 = (?)8
1 2 E
000 100 101 110 (make groups of 3 bits and write equivalent number from table)
0 4 5 6
= (0456)8