[go: up one dir, main page]

0% found this document useful (0 votes)
64 views23 pages

Number System

The document provides an overview of number systems used in digital electronics, including decimal, binary, octal, and hexadecimal systems. It explains the advantages of digital systems over analog systems, such as ease of design, data storage, and processing. Additionally, it covers the conversion methods between these number systems and the significance of positional notation and weights in representing numbers.

Uploaded by

Aditi Shetty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views23 pages

Number System

The document provides an overview of number systems used in digital electronics, including decimal, binary, octal, and hexadecimal systems. It explains the advantages of digital systems over analog systems, such as ease of design, data storage, and processing. Additionally, it covers the conversion methods between these number systems and the significance of positional notation and weights in representing numbers.

Uploaded by

Aditi Shetty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

1.

1
NUMBER SYSTEM
15 %

1.1 Digital Electronics.


1.2 Number Systems.
1.3 Conversions.
1.4 Inter conversion.
1.5 Binary Arithmetic.
1.6 1`s and 2`s Compliment.
1.7 Codes.
1.1 Introduction
Electronic systems are basically divided into two types i.e., analog, and digital
system.
Analog electronic systems have been more popular in past. Information dealing with
time, weight, pressure, speed, light intensity etc. all are the analog signal in nature. Analog
system is simple, but its main drawback is storing data there is no provision to store data
in analog system.
Digital systems are required when data must be stored and used for calculation and
display in numeric and alpha numeric form. Due to the following advantages digital
systems are very famous and widely used.
1) System can be designed more easily by using compatible digital logic families.
2) Inexpensive ICs can be used with few external components.
3) Information can be stored easily.
4) Data or information can be processed easily.
5) Numeric as well as alphanumeric information can be viewed by using various
displays.
6) System can be programmed easily.
7) Digital circuits are less affected by unwanted electric signal known as noise.
1.2 Number System
Number system is used in our daily life to feed data in various systems. The number
system widely used are Decimal, Binary, Octal, Hexadecimal. In any number system base
or radix gives the number of digits included in it.
Base or radix is defined as the total number of digits included in that number
system. For decimal number system base is 10, for binary it is 2, for octal it is 8, and for
hexadecimal number system it is 16.
a) Decimal number system: - The number system with base 10 is known as decimal
number system. This number system is widely used in our daily life. In this number system
10 different symbols are used to specify any number i.e., 0, 1, 2….9.
for example (2408)10
b) Binary number system: - The number system with base 2 is known as binary number
system. In this number system only two symbols are used i.e.,0 and 1. These numbers are
known as Bits (Binary digit). The left most bit in this number system is known as
Most Significant Bit (MSB) and right most bit is known as Least Significant Bit (LSB). The
binary number system is most useful in digital circuits because there are only two digits.
This number system has a minimum base.
For example: - (10110110)2
1.2

In binary number system a group or string of 4 bits is known as nibble and group of
8 bits is known as byte.
Nibble is defined as the group of four bits made from LSB in binary number system.
Byte is defined as group of eight bits made from LSB in binary number system.
For example (100110010110)2 (100110010110)2
N N N N = Nibble B B = Byte
c) Octal number system: - The number system with base 8 is known as the octal number
system.
In this number system eight symbols are used to represent data i.e., 0, 1, 2… 7
Octal number system is used instead of binary number system because long string
of binary numbers is inconvenient to handle and remember and there is possibility of errors
while entering the data therefore octal number system is used in digital circuits and
microprocessors.
Binary number 101010 can be easily remembered as 52 in octal number system and
entered in digital circuits as 52, but digital circuits can process only with 0 and 1 hence
this octal number is converted in to binary and then applied to digital circuit.
For example (3751)8
d) Hexadecimal number system: - A number system whose base is 16 is known as
hexadecimal number system. In this number system 16 symbols are used to represent
numbers. Numbers from 0 to 9 and alphabets from A to F are used to represent this
number system hence this number system is also known as alpha numeric number system.
The advantage of hexadecimal number system is that it is directly converted from 4 bit
binary number. Hexadecimal number system is widely used in microprocessor based digital
circuits to represent 4, 8, 16, -- bits binary numbers.
For example (6AB.D)16
Table 1.1
Decimal Binary Octal Hexadecimal
B4 B3 B2 B1 B0
0 0 0 0 0 0 0 0
1 0 0 0 0 1 1 1
2 0 0 0 1 0 2 2
3 0 0 0 1 1 3 3
4 0 0 1 0 0 4 4
5 0 0 1 0 1 5 5
6 0 0 1 1 0 6 6
7 0 0 1 1 1 7 7
8 0 1 0 0 0 10 8
9 0 1 0 0 1 11 9
10 0 1 0 1 0 12 A
11 0 1 0 1 1 13 B
12 0 1 1 0 0 14 C
13 0 1 1 0 1 15 D
14 0 1 1 1 0 16 E
15 0 1 1 1 1 17 F
16 1 0 0 0 0 20 10
17 1 0 0 0 1 21 11
18 1 0 0 1 0 22 12
19 1 0 0 1 1 23 13
20 1 0 1 0 0 24 14

Positional notation and weight: - We express any decimal number in units, tens,
hundreds, thousands and so on.
For example (35074)10= 3×104+5×103+0×102+7×101+4×100
= 3×10000+5×1000+0×100+7×10+4×1
= 30000+5000+0+70+4
= 35074
1.3

From this we can conclude that each digit position has weight. The sum of all digits
multiplied by their weights gives the number being represented.
Binary weight: - We can also write any binary number in terms of weight. The least
significant bit has weight of one, second position has weight of 2, next is 4, 8 and so on. For
fractional numbers the weight of bit position are given by 2-1, 2-2, 2-3 and so on.
Table 1.2
Binary 28 27 26 25 24 23 22 21 20 . 2-1 2-2 2-3 2-4
number
Decimal 256 128 64 32 16 8 4 2 1 . 0.5 0.25 0.125 0.0625
equivalent

For example: - (10101.101)2 = 1×24+0×23+1×22+0×21+1×20+.1×2-1+0×2-2+1×2-3


= 1×16+0×8+1×4+0×2+1×1+. 1×.5+×0×.25+1×.125
=16+0+4+0+1+.5+0+.125
= 21.625
Octal weight: - Like digital and binary number system it is also positional system each
digit position has weight. The weight of the octal number system is given in the following
table.
Table 1.3
Octal 85 84 83 82 81 8 0 . 8-1 8-2 8-3 8-4
number
Decimal 32768 4096 512 64 8 1 . .125 .01562 .00195 .00024
equivalent
For example: - (3672.451)8 = 3×83+6×82+7×81+2×80+. 4×8-1+5×8-2+1×8-3
= 3×512+6×64+7×8+2×1+.4×.125+×5×.0156+1×.0019
=1536+384+56+2+.5+.078+.0019
= 1978.5799
Hexadecimal weight: - This number system is also positional system where each digit
position has weight. The weight of the hexadecimal number system are given in the
following table.
Table 1.4
Hexadecimal 164 163 162 161 160 . 16-1 16-2 16-3
number
Decimal 35536 4096 256 16 1 .0625 .00396 .00024
equivalent
For example: - (A893.24)16 In this system A = 10
(A893.24)16 = 10 893.24
= 10×163+8×162+9×161+3×160+.2×16-1+4×16-2
= 10×4096+8×256+9×16+3×1+.2×.0625+×4×.0039
= 40960+2048+144+3+.125+.0156
= 43155.1406
1.3 Conversion
A) Binary to decimal: - Any binary number can be converted into its equivalent decimal
number by using the weights assigned to each bit position which given in table 1.2
The Procedure for conversion is.
a) Integer number: - 1) Write down the given binary number accurately.
2) Write weight of each bit under binary number from right to left such as 20,21, 22,
2 ….
3

3) Cancel the weight where bit is zero.


4) Add the remaining weights to get equivalent decimal number.
b) Fractional number: - 1) Write down binary number accurately.
2) Write weight of each bit under binary from binary point such as 2-1, 2-2, 2-3….
3) Cancel the weight where bit is zero.
4) Add the remaining weight to get decimal equivalent.
1.4

For example: - (10101.101)2 = (?)10


1 0 1 0 1. 1 0 1
124 +023 +122+021+120+12-1+02-2 +12-3
116 +0+14 +0+ 11 +10.5 +0.25+1 0.125 = 16+4+1+0.5+0 +0.125 =21.625
(10101.101)2 = (21.625)10
Ex 1.1) Convert the following binary numbers into decimal.
1) (1011011101)2 = (?)10
= 129+028 +127+126+025+124+123 +122+021+120
= 1512 + 0+1128 +164 + 0 + 116 + 1  8 + 1 4 +0 +11
= 512 + 128 + 64 + 16 + 8 + 4 + 1 = 733
= (1011011101)2 = (733) 10
2) (11001.101) 2 = (?)10
= 124+123 +022+021+120+12-1+02-2 +12-3
= 116 + 18 + 0 + 0 +11+ 1  0.5+ 0 +10.125
= 16 + 8 + 1 + 0.5 + 0.125
= 25. 625
(11001.101)2 = (25.625)10
3) (100110.011)2 = (?)10
= 125+024+023 +122+121+020+02-1+12-2 +12-3
= 132+0+0+14+12+01+0.5+1.25+1.125
= 32+4+2+.25+.125
= 38.375
(100110.011)2= (38.375)10
4) (1100110.0101)2 = (?)10
= 126+125+024+023 +122+121+020+02-1+12-2 +02-3+12-4
= 164 + 132+ 0 + 0 + 1 4 +1 2 +01+0.5+1.25+0.125+1.0625
= 64+32+0+0+4+2+0+0+.25+0+.0625
=102.3125
(1100110.0101)2 = (102.3125)10
B) Decimal to binary: - The process of conversion of decimal to binary is known as double
dabble method.
The procedure for conversion is.
A) For Integer Number: - 1) Divide given decimal number successively by 2
2) Write down quotient below the number.
3) Write down reminder on the right side.
4) Continue the process till we get zero with reminder 1.
5) Reminder reads in upward direction (Bottom to Top) gives equivalent binary number
of given decimal number.
B) For Fractional Number: - 1) Multiply given fractional number by 2.
2) The integer part is kept aside.
3) The remaining fraction is again multiplied by 2.
4) This process can continue till the answer is sufficiently accurate (at least 5 bits).
(85.75)10 = (?)2
A) Integer Number (B) Fractional Number
2 85
2 42 1 0.75
2 21 0
 2 (.11) 2
2 10 1
2 5 0 1.5
2 2 1  2
2 1 0
0 1 1.0
(1010101) 2
(85.75) 10 = (1010101.11)2
1.5

Ex 1.2) Convert the following decimal numbers into binary.


a) (110.6875)10 = (?)2
A) Integer Number (B) Fractional Number
0.6875
2 110
 2 (.1011) 2
2 55 0
1.375
2 27 1
 2
2 13 1
0.75
2 6 1
 2
2 3 0 1.5
2 1 1
 2
0 1 1
(1101110) 2
(110.6875) 10 = (1101110.1011)2
b) (233.375)10 = (?)2
A) Integer Number (B) Fractional Number
0.375
2 233
 2 (.011) 2
2 116 1
0.75
2 58 0
 2
2 29 0
1.50
2 14 1
 2
2 7 0 1.0
2 3 1
2 1 1 (11101001) 2
0 1

(233.375)10 = (11101001.011)2

C) Octal to decimal: - This process is similar to binary to decimal conversion. In this


conversion power of eight is used instead of two, for example 8 4, 83, 82, 81, 80, 8-1, 8-2….
Ex 1.3) Convert the following octal numbers into decimal.
a) (36742.56)8 = (?)10
= 384+683 +782+481+280+58-1+68-2
= 34096+6512 +764+48+21+5.125+6.0156
= 12288+3072+448+32+2+.625+.0117
= (15842.6367)10
(36742.56)8 = (15842.6367)10
b) (543266.142)8 = (?)10
=585+ 484+383 +282+681+680+18-1+48-2+28-3
=532768+ 44096+3512 +264+68+61+1.125+4.01564+2.0019
= 163840+16384+1536+128+48+6+.125+.0625+.0038
= 181942.19
(543266.142)8 = (181942.19)10
c) (35612.47)8 = (?)10
= 384+583 +682+181+280+48-1+78-2
= 34096+5512 +664+18+21+4.125+7.0156
= 12288+2560+384+8+2+.5+.10934
= 15242.60934
(35612.47)8 = (15242.60934)10
D) Decimal to Octal: - This process is like decimal to binary conversion. In this conversion
no 8 is used instead of no 2.
1.6

Ex 1.4) Convert the following decimal numbers into octal.


a) (15842.7186)10 = (?)8
A) Integer Number (B) Fractional Number
0.7186
8 15842
 8 (.557) 8
8 1980 2
5.7488
8 247 4
 8
8 30 7
5.9904
8 3 6
 8
8 0 3 7.9232
36742
(15842.7186)10 = (36742.557)8
b) (181942.19)10 = (?)8
A) Integer Number (B) Fractional Number
0.19
8 181942
 8 (.141) 8
8 22742 6
1.52
8 2842 6
 8
8 355 2
4.16
8 44 3
 8
8 5 4 1.28
0 5 543266
(181942.19)10 = (543266.141)8
c) (13684.91603)10 = (?)8
A) Integer Number (B) Fractional Number
0.91603
8 13684
 8 (.725) 8
8 1710 4
7.32824
8 213 6
 8
8 26 5
2.62592
8 3 2
 8
0 3 5.00736
32564
(13684.91603)10 = (32564.725)8
E) Hexadecimal to decimal: - This process is like binary to decimal and octal to decimal
conversion. In this conversion power of sixteen is used instead of two and eight, for example
164, 163, 162, 161, 160, 16-1, 16-2….
Ex 1.5) Convert the following hexadecimal numbers into decimal.
a) (A893.24)16= (?)10
In case of hexadecimal number system, A = 10
 A893.24 = 10 893.24
= 10163 + 8162 +9161+ 3160 +216-1+416-2
= 104096 + 8256 +916+ 31 +2.0625+4.003962
= 40960 + 2048+144+3+.125+.015848
= 43155.140848
(A893.24)16= (43155.140848)10
b) (DAD)16 = (?)10
In case of Hexadecimal number system D = 13, A = 10
DAD = 13 10 13
= 13162 + 10161 +13160
= 13256 +1016 +131 = 3328+160+13 = 3501
(DAD)16= (3501)10
1.7

c) (342D.75)16 = (?)10
In case of Hexadecimal number system D = 13
342D.75 = 34210.75
= 3163 + 4162 +2161+ 10160 +716-1+516-2
= 34096 + 4256 +216+ 101 +7.0625+5.003962
= 12288+ 1024+32+13+.4375+.01981
= 13357.45731
(342D.75)16 = (13357.45731)10
d) (2F.8)16 = (?)10
In case of Hexadecimal number system F = 15
2F.8 = 2 15 .8 = 2161 +15160 + 816-1
= 216+151+ 80.0625 = 32+15+.5 = 47.5
(2F.8)16 = (47.5)10
e) (7FF.8)16 = (?)10
In case of Hexadecimal number system F =15
 7FF.8 = 7 15 15. 8 = 7162 +15161+15160 + 816-1
= 7256 + 1516 +15 1 +80.0625 = 1792 + 240 + 15 +0.5 = 2047.5
(7FF.8)16 = (2047.5)10
F) Decimal to Hexadecimal: - This process is like decimal to binary and decimal to octal
conversion. In this conversion no 16 is used instead of no 2 and no 8.
Ex 1.6) Convert the following decimal numbers into hexadecimal numbers.
a) (43155.140848)10 = (?)16
A) Integer Number (B) Fractional Number
0.140848
16 43155
 16 (.24) 16
16 2697 3
2.253568
16 168 9
 16
16 10 8
4.057088
0 10 10893 but 10 is represented as A
10893 = A893
(43155.140848)10 = (A893.24)16
b) (253) 10 = (?) 16

16 253 (15 13)


16 15 13
0 15
In case of Hexadecimal number system 15 = F, 13= D
 (251) 10 =(15 13) 16 = (FD) 16
c) (13357.4570)10 = (?)16
A) Integer Number (B) Fractional Number
0.4570
16 13357
 16 (.74) 16
16 834 13
7.312
16 52 2
 16
16 3 4
4.992
0 3 34213 but 13 is represented as D
34213 = 342D
(13357.4570)10 = (342D.74)16
d) (2905) 10 = (?)16
16 2905
16 181 9
16 11 15 (11 15 9)
0 11
(2905)10 = (11 15 9)16
In case of Hexadecimal number system 11= B ,15 = F
1.8

(2905) 10 = (BF 9)16

e) (2479) 10 = (?)16
16 2479
16 154 15
16 9 10 (91015)
0 9
In case of Hexadecimal number system 10 = A, 15= F
(2479)10 = (9 10 15) 16 = (9AF) 16
1.4 Inter conversion.
A) Binary to Octal: -Binary numbers can be converted into octal number by using following
steps.
A) For integer Number: -
1) Write down the given binary number accurately.
2) Make a group of three bits from LSB to MSB.
3) If the group is incomplete add the number of zeros after MSB.
4) Replace each group with their equivalent octal number.
B) Fractional Number: -
1) The grouping is now made from binary point.
2) If the group is incomplete add the number of zeros in last group.
3) Replace each group with their equivalent octal number.
The resultant number is equivalent to the octal number of given binary number.
Ex 1.7) Convert the following binary numbers into octal number.
a) (100101011110.110011101)2 = (?)8
Sol: - 100101011110.110011101
= 100 101 011 110 .110 011 101

4 5 3 6 6 3 5 = 4536.635
(100101011110.110011101)2 = (4536.635)8
b) (110100101101.100110101101)2 =(?)8
Sol: - 110100101101.100110101101
= 110 100 101 101. 100 110 101 101

6 4 5 5 4 6 5 5 = 6455.4655
(110100101101.100110101101)2 = (6455.4655)8
c) (100100111011010.001011010)2 =(?)8
Sol: - 100100111011010.001011010
= 100 100 111 011 010 . 001 011 010

4 4 7 3 2 1 3 2 = 44732. 132
(100100111011010.001011010)2 = (44732.132)8
d) (11101000101011101.11010010111)2 =(?)8
Sol: - 11101000101011101.11010010111
= 011 101 000 101 011 101. 110 100 101 110

3 5 0 5 3 5 6 4 5 6 = 350535. 6456
(11101000101011101.11010010111)2 = (350535.6456)8
B) Octal to Binary: - In this conversion each octal number is replaced by their three-bit
equivalent binary number so that we can get binary equivalent of given octal number.
1.9

Ex 1.8) Convert the following octal numbers into binary number.


a) (53672.142)8 =(?)2
Sol: - 53672.142
= 5 3 6 7 2 .1 4 2

=101 011 110 111 011.001 100 011


(53672.142)8 = (101011110111011.001100011)2
b) (2461.753)8 =(?)2
Sol: - 2461.753
= 2 4 6 1 .7 5 3

=011 100 110 001.111 101 011


(2461.753)8 = (011100110001.111101011)2 = (11100110001.111101011)2
c) (67354.103)8 =(?)2
Sol: -67354.103
= 6 7 3 5 4 .1 0 3

= 110 111 011 101 100. 001 000 011


(67354.103)8 = (110111011101100.001000011)2
d) (350535.6456)8 =(?)2
Sol: - 350535.6456
= 3 5 0 5 3 5 .6 4 5 6

= 011 101 000 101 011 101. 110 100 101 110
(350535.6456)8 = (011101000101011101.110101110)2
(350535.6456)8 = (111010000101011101.11010111)2
C) Binary to Hexadecimal: -Binary numbers can be converted into hexadecimal number
by using following steps.
A) For integer Number: -
1) Write down the given binary number accurately.
2) Make a group of four bits from LSB to MSB.
3) If the group is incomplete add the number of zeros after MSB.
4) Replace each group with their equivalent hexadecimal number.
5) If the equivalent number is greater than 9 that number is replaced by their equivalent
alphabets such as 10 = A, 11 = B etc...
B) Fractional Number: -
1) The grouping is now made from binary point.
2) If the group is incomplete add the number of zeros in last group.
3) Replace each group with their equivalent hexadecimal number.
The resultant number is equivalent to the hexadecimal number of given binary number.
Ex 1.9) Convert the following binary numbers into hexadecimal number.
a) (100101011110.11001110)2 =(?)16
Sol: - 100101011110.11001110
= 1001 0101 1110.1100 1110

9 5 14. 12 14
In case of Hexadecimal number system 14= E, 12 = C
(100101011110.11001110)2 = (9 5 14.12 14)16 = (95E.CE)16
b) (110100101101.100110101101)2 =(?)16
Sol: - 110100101101. 100110101101
= 1101 0010 1101.1001 1010 1101

13 2 13. 9 10 13
In case of Hexadecimal number system 13= D, 11 = B, 10 = A
(110100101101.100110101101)2 = (13 2 13.9 11 10)16 = (D2D.9BA)16
1.10

c) (110101.1100)2 = (?)16
Sol: - 110101.1100
= 0011 0101 .1100

3 5 12
In case of Hexadecimal number system 12 = C
(110101.11000)2 = (3 5 12)16 = (35.C)16
d) (1101101.1101)2 = (?)16
1101101.1101 As last nibble is incomplete 0 is added to complete the nibble
01101101.1101

6 13 13
In case of Hexadecimal number system 13=D
(1101101.1101)2 = (613.13)16 = (6D.D)16
e) (101100110101.10110111)2 = (?)16
Sol: - 101100110101.10110111
= 1011 0011 0101 . 1011 0111

11 3 5 11 7
In case of Hexadecimal number system 11=B
(101100110101.10110111)2 = (11 35.7)16 =(B35.7)16
D) Hexadecimal to Binary: - In this conversion each hexadecimal number is replaced by
their four-bit equivalent binary number so that we can get binary equivalent of given
hexadecimal number.
Ex 1.10) Convert the following hexadecimal numbers into binary number.
a) (2BAD) 16 = (?)2
Sol: -In case of Hexadecimal number system B =11, A = 10, D = 13
2BAD = 2 11 10 13

0010 1011 1010 1101


(2BAD)16 = 0010101110101101 = (10101110101101)2
b) (B35.7)16 = (?)2
Sol: -In case of Hexadecimal number system B =11
B35.7 = 11 3 5 . 7

1011 0011 0101. 0111


(B35.7)16 = (101100110101.0111)2
c) (2AF.C)16 = (?)2
Sol: - In case of Hexadecimal number system A=10,C = 12, F = 15
2AF.C = 2 10 12 . 15
=2 10 15 . 12

0010 1010 1111 .1100


(2AF.C)16 = (001010101111.1100)2= (1010101111.11)2
d) (DAD4.BA)16 = (?)2
Sol: -In case of Hexadecimal number system D= 13, A=10,B = 11
DAD4.BA = 13 10 13 4.1110
= 13 10 13 4 . 11 10

1101 1010 1101 0100. 1011 1010


(DAD4.BA)16 = (1101101011010100.10111010)2
e) (BABA.927)16 = (?)2
Sol: -In case of Hexadecimal number system A=10,B = 11
1.11

BABA.927 = 11 10 11 10.927
= 11 10 11 10 . 9 2 7

= 1011 1010 1011 1010. 1001 0010 0111


(DAD4.BA)16 = (1011101010111010.100100100111)2
1.5 Binary Arithmetic
A) Addition: - The rules for binary addition are
Augends Addend Carry Sum Result
0 0 0 0 00
0 1 0 1 01
1 0 0 1 01
1 1 1 0 10
Ex 1.11) Perform the following addition.
a) (110011)2 + (11010)2 = (?)2
Sol: - 110011+11010
11 1
110011
+ 011010
1001101
(110011)2 + (11010)2 = (1001101)2
b) (11011)2 + (10010)2 = (?)2
Sol: - 11011+10010
1 1
11011
+10010
101101
(11011)2 + (10010)2 = (101101)2
c) (111011)2+ (111011)2 = (?)2
Sol: - 111011+111011
111 11
111011
+ 111011
1110110
(111011)2 +( 111011)2 = (111011)2
d) (10111)2 + (1100)2 = (?)2
Sol: - 10111+1100
111
10111
+ 01100
100011
(10111)2 + (1100)2 = (100011)2
e) (1101111)2 + (111101)2 = (?)2
Sol: - 1101111+111101
1111111
1101111
+ 111101
10101100
(1101111)2+(111101)2= (10101100)2
B) Subtraction: - The rules for binary subtraction are
Minuend Subtrahend Borrow Difference Result
0 0 0 0 00
0 1 1 1 11
1 0 0 1 01
1 1 0 0 00
1.12

Ex 1.12) Perform the following subtraction.


a) (11011)2-(10101)2=(?)2
Sol: - 11011-10101
1 Borrow
11011
- 10101
00110
(11011)2-(10101)2= (110)2
b) (1101101)2-(1001110)2= (?)2
Sol: - 1101101-1001110
1111 Borrow
1101101
- 1001110
0011111
(1101101)2-(1001110)2= (11111)2
c) (110101)2-(101111)2=(?)2
Sol: - 110101-101111
111 Borrow
110101
- 101111
010110
(110101)2-(101111)2= (10110)2
d) (10110)2-(10011)2=(?)2
Sol: - 10110-10011
11 Borrow
10110
- 10011
00011
(10110)2-(10011)2= (11)2
e) (111101)2-(10101)2=(?)2
Sol: - 111101-10101
111101
- 10101
101000
(111101)2-(10101)2= (101000)2
C) Multiplication: - The rules for binary multiplication are
a) 0×0 = 0
b) 0×1 = 0
c) 0×1 = 0
d) 1×1 = 1
Ex 1.13) Perform the following multiplication.
a) (10110)2 × (101)2= (?)2
Sol: - 10110 × 101
10110
× 101
10110
000000
1011000
1101110
(10110)2 × (101)2= (1101110)2
1.13

b) (110101)2 × (1101)2= (?)2


Sol:- 110101 × 1101
110101
× 1101
110101
0000000
11010100
110101000
1010110001
(110101)2 × (1101)2= (1010110001)2
c) (111001)2 × (1010)2= (?)2
Sol: - 111001 × 1010
111001
× 1010
000000
1110010
00000000
111001000
1000111010
(111001)2 × (1010)2= (1000111010)2
D) Division: - The rules for binary divisions are
a) 0  0 = 0
b) 0  1 = 0
c) 1  0 = 
d) 1  1 = 1
Ex 1.14) Perform the following division.
a) (101011)2  (100)2
Sol: - 101011100
1010
100 ) 101011
-100
00101
- 100
0011
(101011)2  (100)2 = (1010) 2 with remainder (011)2
b) (1110111)2(101)2
Sol: - 1110111101
10111
101) 1110111
-101
01001
- 101
1001
- 101
1001
- 101
100
(1110111)2  (101)2 = (10111) 2 with remainder (100)2
c) (1110101)2  (1001)2
Sol: - 11101011001
1.14

1101
1001) 1110101
- 1001
1011
- 1001
1001
- 1001
0000
(1110101)2  (1011)2 = (1101) 2
1.6 1`s and 2`s Compliment.
A) 1`s compliment: - In Binary number if each 1 is replaced by 0 and each 0 is
replaced by 1 the resulting number is known as 1`s compliment of first number.
Both numbers are 1`s compliment of each other. If 1 st number is positive, then
resulting number is negative with same magnitude.
For example: -
(10101)2 1`s Compliment (01010)2
(21) 10 = (-21) 10
Ex 1.15) Find out 1`s compliment of following numbers.
1) (10110101)2
Sol: - 10110101
= 10110101 1`s Compliment 01001010
2) (101001101)2
Sol: - 101001101
= 101001101 1`s Compliment 010110010
3) (1110010101)2
Sol: - 1110010101
= 1110010101 1`s Compliment 0001101010
4) (10010100101)2
Sol: - 10010100101
= 10010100101 1`s Compliment 01101011010
5) (110010011010)2
Sol: - 110010011010
= 110010011010 1`s Compliment 001101100101
A) Subtraction using 1`s compliment
Rules for subtraction using 1`s compliments are.
1) Find out 1`s compliment of number which is to be subtracted.
2) Add this number with the 1st number.
3) If EAC (End Around Carry) is present in the answer add EAC in the remaining
bits to get the final answer. This answer is positive.
4) If EAC is absent find out 1`s compliment of this addition to get final answer but
this answer is negative.
For example: -
a) 10111 – 10011
1) Using 1`s compliment subtraction method.
10111
- 10011 1`s Compliment 01100

111
10111
+ 01100
100011
+ 1
000100
1.15

b)10011 – 10111
10011
- 10111 1`s Compliment 01000

10011
+ 01000
11011
As EAC (End Around Carry) is absent answer is negative and it is 1`s compliment of
above answer.
110111 1`s Compliment - 00100
Ex 1.16) Subtract using 1’s compliment method.
a) (1011)2 – (10001)2 = (?)2
01011
- 10001 1`s Compliment 01110

111
01011
+01110
11001
As EAC (End Around Carry) is absent answer is negative and it is 1`s compliment of
above answer.
11001 1`s Compliment -00110
(1011)2 – (10001)2 = -(00110)2
b) (11010)2 – (110111)2 = (?)2
11010
- 110111 1`s Compliment 001000

11
11010
+001000
100010
As EAC (End Around Carry) is absent answer is negative and it is 1`s compliment of
above answer.
100010 1`s Compliment -011101
(1010)2 – (110111)2 = (-011101)2
c) (11011)2 – (01101)2 = (?)2
11011
- 01101 1`s Compliment 10010

1 1
11011
+10010
101101
As EAC is present answer is positive, but we have added EAC in remaining bits
001101
+ 1
001110
(11011)2 – (01101)2 = (001110)2
d) (101)2 – (1101)2 = (?)2 (Problem for practice)
101
- 1101 1`s Compliment 0010
1
101
+ 0010
0111
1.16

As EAC (End Around Carry) is absent answer is negative and it is 1`s compliment of
above answer.
0111 1`s Compliment -1000
(101)2 – (1101)2 = -(1000)2
e) (11100)2 – (00100)2 = (?)2 (Problem for practice)
11100
- 00100 1`s Compliment 11011

11
11100
+11011
110111
As EAC is present answer is positive, but we have added EAC in remaining bits
10111
+ 1
11000
(11100)2 – (00100)2 = (11000)2
B) 2`s compliment: - If binary number 1 is added in the 1`s compliment the resulting
number is 2`s compliment of given number.
For example:- :-
(10101)2 1`s Compliment (01010)2
+ 1
(10101)2 2`s Compliment (01011)2

Ex 1.17) Find out 2`s compliment of following numbers.


1) (10110101)2
Sol: - 10110101
= 10110101 1`s Compliment 01001010
+ 1
= 10110101 2`s Compliment 01001011
2) (101001101)2
Sol: - 101001101
= 101001101 1`s Compliment 010110010
+ 1
= 101001101 2`s Compliment 010110011
3) (1110010101)2
Sol: - 1110010101
= 1110010101 1`s Compliment 0001101010
+ 1
= 1110010101 2`s Compliment 0001101011
4) (111101101)2
Sol: - 111101101
= 11 1101101 1`s Compliment 000010010
+ 1
= 111101101 2`s Compliment 000010011
5) (110110101)2
Sol: - 110110101
= 1101101011 1`s Compliment 0010010100
+ 1
= 110110101 2`s Compliment 0010010101
B) Subtraction using 2`s compliment
Rules for subtraction using 2`s compliments are.
1) Find out 2`s compliment of number which is to be subtracted.
2) Add this number with the 1st number.
1.17

3) If EAC (End Around Carry) is present in the answer disregard EAC and the remaining
bits gives the final answer.
4) If EAC is absent find out 2`s compliment of this addition to get final answer but this
answer is negative.
For example: - For example: -1) (10111 – 10011)2 = (?)2
10111
- 10011 2`s Compliment 01101

11 1
10111
+ 01101
100100
As EAC is present answers is positive, but disregard EAC and remaining bits is final
answer.
100100 = 00100
2) (10011 – 10111)2 = (?)2
10011
- 10111 2`s Compliment 01001

11 1
10011
+ 01001
11100
As EAC (End Around Carry) is absent answer is negative and it is 2`s compliment of
above answer.
11100 2`s Compliment - 00100
Advantages: - 1) In 2`s compliment only one addition is required.
2) This type of circuit is faster.
Ex 1.18) Subtract using 2’s compliment method.
a) (111011)2 – (101)2 = (?)2
111011
- 000101 2`s Compliment 111011

111 11
111011
+ 111011
1110110
As EAC is present answer is positive, but disregard EAC and remaining bits is final
answer.
(111011)2 –(101)2 = (110110)2
b) (11)2 - (11111)2 =(?)2
00011
- 11111 2`s Compliment 00001

11
00011
+ 00001
00100
As EAC (End Around Carry) is absent answer is negative and it is 2`s compliment of
above answer.
00100 2`s Compliment -11100
(11)2 - (11111)2 = (-11100)2
1.18

c) (1011)2 - (101)2 = (?)2


1011
- 0101 2`s Compliment 1011

1 11
1011
+ 1011
10110
As EAC is present answer is positive, but disregards EAC and remaining bits is final
answer.
(1011)2- (101)2 = (0110)2
d) (11011)2 - (1100)2 = (?)2
11011
- 01100 2`s Compliment 10100

11
11011
+ 10100
101111
As EAC is present answer is positive but disregards EAC and remaining bits is final
answer.
(1011)2- (101)2 = (01111)2
e) (110100)2 – (1000001)2
110100
- 1000001 2`s Compliment 0111111

1111
110100
+ 0111111
1110011
As EAC (End Around Carry) is absent answer is negative and it is 2`s compliment of
above answer.
1110011 2`s Compliment -0001101
(52)10-(65)10 = - (0001101)2

1.7 Codes.
Computers and other digital instruments process data in binary form. Various
special codes are used in digital electronic to represent numbers, letters, special characters,
and control characters. In modern electronic systems several encoders and decoders are
used for translating code. Encoders are used to convert input information into to a code
useful to digital circuitry while decoder is used to convert an encrypted code into code that
is more understandable. In every code information is represented in binary form. Codes are
used for error detection and error correction in digital systems.
Some of the commonly used codes are.
a) Natural binary code, (b) Octal code, (c) Hexadecimal code, (d) Natural BCD code,
(e) Excess 3 code, (f) Grey code, (g) ASCII code, (h) EBCDIC code, (i)12-bit Hollerith code,
(j) Error code, k) Uni code
A) Natural Binary Code: - This is used to represent number using natural binary
form. For details ref Binary number system page, no 1.1
B) Octal Code: - It is a three-bit code in which octal digits 0 to 7 are coded into
binary form. For details ref Octal number system page, no 1.2
C) Hexadecimal Code: - It is a 4-bit binary code in which 0 to 9 are represented by
their equivalent binary no and remaining numbers from 10 to 15 are represented by
alphabets A to F. For details ref Hexadecimal number system page, no 1.2
D) Binary Coded Decimal Code: - It is Binary Coded Decimal code; it has combined
feature of binary and decimal numbers. 8421, Excess 3 and Grey code are the example of
this code
1.19

(1) 8421 Code: - In this code each decimal digit is represented by their natural
binary equivalent. In this code 8, 4, 2, 1(i.e., 23, 22, 21, 20) are the weights of binary number
of each digit. As 9 is the largest number in decimal number system the largest nibble in
8421 is 1001. This code is very useful to feed data in computer and other digital circuits. It
is used in counters, digital multi meters and pocket calculators.
BCD code is binary within the group, and it is decimal form group to group hence
this code is known as mixed base code.
Advantages: -1) It is very easy to convert any decimal into BCD number.
2) BCD numbers can be easily converted back to decimal numbers.
3) Keyboard required to enter the data is very simple and it has BCD encoder.
4) Display of decoder circuit is also very simple.
Disadvantages: - 1) BCD code is not suitable for computers and micro controllers.
2) BCD requires more numbers of bits compared to corresponding binary numbers.
3) Arithmetic circuits BCD numbers are very complicated.
(2) Excess 3 Code: - This is the next version of BCD code. The code for each decimal
digit is obtained by adding decimal number 3 to the natural BCD code of digit. It is not a
weighted code but a self-complimenting code.
(3) Grey Code: - The Grey code was invented by Frank Grey. It is a very useful code
in which decimal number is represented in binary form in such a way that each number
differs from preceding number and succeeding number. This code is also not weighted code
which is mostly used in optical shaft encoding. The Grey code cannot be used in arithmetic
circuits.
Decimal Binary BCD Excess-3 Grey
Number B4 B3 B2 B1 B0 D C B A E3 E2  E1 E0 G3 G2 G1 G0
0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0
1 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 1
2 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 1 1
3 0 0 0 1 1 0 0 1 1 0 1 1 0 0 0 1 0
4 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 1 0
5 0 0 1 0 1 0 1 0 1 1 0 0 0 0 1 1 1
6 0 0 1 1 0 0 1 1 0 1 0 0 1 0 1 0 1
7 0 0 1 1 1 0 1 1 1 1 0 1 0 0 1 0 0
8 0 1 0 0 0 1 0 0 0 1 0 1 1 1 1 0 0
9 0 1 0 0 1 1 0 0 1 1 1 0 0 1 1 0 1
10 0 1 0 1 0 1 1 1 1
11 0 1 0 1 1 1 1 1 0
12 0 1 1 0 0 1 0 1 0
13 0 1 1 0 1 1 0 1 1
14 0 1 1 1 0 1 0 0 1
15 0 1 0 1 1 1 0 0 0
Conversion: -
A) BCD to Decimal Conversion: -The procedure for BCD to decimal conversion is
1) Write down the given BCD number accurately.
2) Make the group of four bits from LSB to MSB.
3) Write its decimal equivalent below each group.
4) Combine all numbers together to get equivalent decimal number.
Ex 1.17) Convert the following BCD numbers into Decimal number.
a) (1001 1000 0001) BCD = (?)10
Sol: - 1001 1000 0001
= 1001 1000 0001

9 8 1 = 981
(1001 1000 0001) BCD = (981)10
b) (111 1001 0110 1000) BCD = (?)10
Sol: - 111 1001 0110 1000
1.20

= 0111 1001 0110 1000

7 9 6 8 = 7968
(111 1001 0110 1000) BCD = (7968)10
c) (1001 1000 0111 1000 0111) BCD = (?)10
Sol: - 1001 1000 0111 1000 0111
= 1001 1000 0111 1000 0111

9 8 7 8 7 = 98787
(1001 1000 0111 1000 0111) BCD = (98787)10
d) (1000 0100 0111 0011 0010 0101) BCD = (?)10
Sol:- 1000 0100 0111 0011 0010 0101
= 1000 0100 0111 0011 0010 0101

8 4 7 3 2 5 = 847325
(1000 0100 0111 0011 0010 0101) BCD = (847325)10
B) Decimal to BCD Conversion: -The procedure for decimal to BCD conversion is
1) Write down the given decimal number accurately.
2) Below each digit write it binary equivalent in group of 4 bits (BCD No.).
3) Combine all binary digits together to get equivalent BCD no.
Ex 1.17) Convert the following Decimal numbers into BCD number.
a) (97648)10= (?)BCD
Sol: - 97648
= 9 7 6 4 8

= 1001 0111 0110 0100 1000


(97648)10= (1001 0111 0110 0100 1000) BCD
b) (14738.69)10= (?)BCD
Sol: - 14738.69
= 1 4 7 3 8 . 6 9

= 1001 0111 0110 0100 1000. 0110 1001


(14738.69)10= (1001 0111 0110 0100 1000. 0110 1001) BCD
c) (68294.297)10= (?)BCD
Sol: - 68294.297
= 6 8 2 9 4 . 2 9 7

= 0110 1000 0010 1001 0100. 0010 1001 0111


(68294.297)10= (0110 1000 0010 1001 0100. 0010 1001 0111) BCD
d) (80362.097)10= (?)BCD
sol: - 80362.097
= 8 0 3 6 2 . 0 9 7

= 1000 0000 0011 0110 0010. 0000 1001 0111


(80362.097)10= (1000 0000 0011 0110 0010. 0000 1001 0111) BCD
(g) ASCII Code: - It is standard code accepted by the computer industry. This code is
American Standard Code for Information Interchange.
This is seven-bit alphanumeric code used to represent all numbers alphabets and
special characters such as upper case, lower case, shift, page up page down etc. This code
is also used to feed more than 30 commands of control operations. This code is used for
microcomputers, electronic typewriters etc.… This code is widely used to send information
to and from microcomputers.
Format of this code is X6X5X4 X3X2X1X0, for convenience a gap is shown in the
combination. The first 3-bit combination is represented by decimal digit from 0 to 7 and the
remaining 4-bit combination is represented by a hex digit.
1.21

X3 X2 X1 X0 X6 X5 X4
010 011 100 101 110 111
0000 SP 0 @ P p
0001 ! 1 A Q a q
0010 “ 2 B R b r
0011 # 3 C S c s
0100 $ 4 D T d t
0101 % 5 E U e u
0110 & 6 F V f v
0111 ‘ 7 G W g w
1000 ( 8 H X h x
1001 ) 9 I Y i y
1010 * : J Z j z
1011 + ; K [ k 
1100 , < L \ l |
1101 - = M ] m 
1110 . > N ^ n 
1111 / ? O - o DEL
h) EBCDIC Code: - This also represents alphanumeric characters. This code is
used for the main frame computer. In the case of the main frame computer a large
number of characters and more special commands are required and for this
purpose 8-bit code is developed.
This code is Extended Binary Coded Decimal Interchange Code.
Format of this code is X7X6X5X4 X3X2X1X0
Character Code Character Code
A 11000001 0 11110000
B 11000010 1 11110001
C 11000011 2 11110010
D 11000100 3 11110011
E 11000101 4 11110100
F 11000110 5 11110101
G 11000111 6 11110110
H 11001000 7 11110111
I 11001001 8 11111000
J 11010001 9 11111001
K 11010010 blank 01000000
L 11010011 . 01001011
M 11010100 ( 01001101
N 11010101 + 01001110
O 11010110 $ 01011011
P 11010111 * 01011100
Q 11011000 ) 01011101
R 11011001 _ 01100000
S 11100010 / 01100001
T 11100011 , 01101011
U 11100100 = 01111110
V 11100101
W 11100110
X 11100111
Y 11101000
Z 11101001
For example, the following characters with 8-bit code are.
1) A = 1100 0001, 2) B = 1100 0010, 3) C = 1100 0011 4) Digit 1 = 1111 0001
1.22

i) UNI Code: - It is 16-bit code designed to support languages such as Chinese,


Japanese, Indian etc. This code was developed by Unicode international with support from
IBM, Microsoft, and APPLE.

1) What are different types of number systems? Define radix or base of number system.
(M 08)
2) What is Radix and Weight of number system? Give a suitable example. (M13)
3) Explain with suitable examples the binary to decimal conversion. (M-06, 11)
4) Explain with suitable examples the hexadecimal to decimal conversion. (M 07, 11)
5) Write note on a) BCD code, (b) ASCII code.
6) Write note on 1) ASCII code (2) EBCDIC code.
7) Write note on BCD code. State its advantages and disadvantages.
8) what is BCD code? Why is it called mixed weight code? (M 02, 03,09,10,12, O 04, 06, 07)
9) Explain double dabble method of conversion of decimal number into binary with suitable
examples.
10)What is double dabble method? How will you used to convert decimal numbers 671 and
152 into binary? (O 01,03,06,07,09, M 01,02,03,04,05,10,12)
11) Write rules for binary addition and subtraction. (O 09)
12) Explain 1’s compliment and 2’s compliment of binary number with example.
13) Explain 1`s compliment method of subtraction of binary number with suitable example.
(M 03, 10, 11, 12, O 01, 06, 09)
14) What is 2`s Compliment of Binary Number? Explain 2’s compliment subtraction method
with suitable example. (M 13)
15) Explain 2’s compliment subtraction method with suitable example.
16) Used 1’s and 2’s compliment method to perform following binary subtraction
a) 01101 – 11011, (b) 110011 – 100101 (M 04)
17) Subtract using 1’s compliment method
a) (1011)2 – (10101)2 = (?)2
b) (11100)2 – (110111)2 = (?)2
c) (11011)2 – (01001)2 = (?)2
d) (1101)2 – (1001)2 = (?)2
e) (11011)2 – (10101)2 = (?)2
f) (11010)2 – (00110)2 = (?)2
g) (100101)2 – (101111)2 = (?)2
h) (1010)2 – (101)2 = (?)2
i) (1101)2 – (1010)2 = (?)2
18) Perform the following subtraction using 2`s compliment.
a) (40) 16 - (64)16 = (?)16
b) (52)10- (65)10 = (?)2
c) (1101111)2 - (1101)2 = (?)2
d) (1011)2 - (11111)2 = (?)2
e) (11011)2 - (110)2 = (?)2
f) (11011)2 - (1110)2 = (?)2
g) (11011.1)2 - (10111.1)2 = (?)2
19) Convert the following.
a)(100) 10 = (?)16, (b) (DAD) 16 = (?)10, (c) (BCD) 16 = (?)2, (d) (10101.11) 2 = (?)10
20) (a) Encode the following decimal numbers into BCD numbers.
1) 649, (2) 71,465
(b) Decode the BCD number (1001 0110 0111 1000 0111 0011)
21) Convert the following decimal number into hexadecimal
(a) 2479, (b) 63,718
22) Convert the following.
(a) (2F•8)16 = (?)10, (b) (98•68)10 = (?)2
23) Solve the following. a) (7AB)16 = (?)10, (b)(1001 1000 0001)BCD = (?)10,
1.23

c)(1101101.1101)2 = (?)16,(d) (2BAD) 16 = (?)2


24) Solve the following
a)(A1B) 16=(?)10 , b) (1011011101)2 =(?)10 , c) (2905) 10 = (?)16d) (11001.101) 2 =(?)10,
e) (110101.11000) 2 = (?)16, f) (2AF.C) 16 = (?)2, g) (C5)16 =(?)10, h) (25)10 = (?)2,
i) (69)10 = (?)BCD, j) (B7C) 16 = (?)2, k) (9AF) 16=(?)10
25) If the binary number A = 11001 and B = 10101, find (A+B) and (A-B). (M 13)
26) Objective questions
1) Radix of octal number system is ---- 8
2) It is desired to have sum as 0 with no carry when two inputs are added then ----
Both inputs are low.
3) In negative logic system high is represented as ----- 0.
4) In positive logic system ‘1’reperesent ----- the more positive of two voltage level.
5) Place values of digits in number system are related to radix as ---- (radix)n
6) End Around carry is the carry generated at ---- MSB.
7) The number system which uses alphabets and numbers as symbols is ----
Hexadecimal number system.
8) When the odd decimal number is converted into binary number least significant
bit will be ---- 1.
9) The ASCII code is basically ----- 7 bit code.
10) The number system which uses alphabets as well as number is ---- (O 01)
Hexadecimal number system.
11) The largest 4 bit binary number used in BCD code is ---- 1001 (M 02)
12) 2`s compliment of binary number 1000 is ---- 1000 (O 03)
13) A binary number whose 2`s compliment and it is same, that binary number is ----
10 (O 05)
14) The number that will comes immediately after (FF)16 is --- 100 (O 07)
15) When an even decimal number is converted into binary number least significant bit will
be ---- 0.
16) If we take 2`s compliment twice we get the ---- binary number. Original.
17) EBCDIC is a ---- code which allows maximum ---- characters. 8 bit ---- 256 (M 13)
18) BCD equivalent of decimal number 9999 is ---- 1001 1001 1001 1001
19) In ASCII code A is represented by binary equivalent of decimal no. ---- 65
20) In EBCDIC code A is represented by binary equivalent of decimal no. ---- 193
21) EBCDIC code is generally used with ----- main frame computer.
------------------------------------------------- ---------------------------------------------

You might also like