UNIT I
Number System :
In a digital system, the system can understand only the optional number
system. In these systems, digits symbols are used to represent different
values, depending on the index from which it settled in the number
system.
In simple terms, for representing the information, we use the number
system in the digital system.
The digit value in the number system is calculated using:
1. The digit
2. The index, where the digit is present in the number.
3. Finally, the base numbers, the total number of digits available in the
number system.
Note: When the number system represents a
digit from 0 - 9, the base of the number will
be 10.
Types of Number System
In the digital computer, there are various
types of number systems used for
representing information.
1. Binary Number System
2. Decimal Number System
3. Hexadecimal Number System
4. Octal Number System
Binary Number System
Generally, a binary number system is used in the digital computers. In this
number system, it carries only two digits, either 0 or 1. There are two
1
types of electronic pulses present in a binary number system. The first
one is the absence of an electronic pulse representing '0'and second one
is the presence of electronic pulse representing '1'. Each digit is known as
a bit. A four-bit collection (1101) is known as a nibble, and a collection of
eight bits (11001010) is known as a byte. The location of a digit in a
binary number represents a specific power of the base (2) of the number
system.
Characteristics:
1. It holds only two values, i.e., either 0 or 1.
2. It is also known as the base 2 number system.
3. The position of a digit represents the 0 power of the base(2).
Example: 20
4. The position of the last digit represents the x power of the base(2).
Example: 2x, where x represents the last position, i.e., 1
Examples:
(10100)2, (11011)2, (11001)2, (000101)2, (011010)2.
Decimal Number System
The decimal numbers are used in our day to day life. The decimal number
system contains ten digits from 0 to 9(base 10). Here, the successive
place value or position, left to the decimal point holds units, tens,
hundreds, thousands, and so on.
The position in the decimal number system specifies the power of the
base (10). The 0 is the minimum value of the digit, and 9 is the maximum
value of the digit. For example, the decimal number 2541 consist of the
digit 1 in the unit position, 4 in the tens position, 5 in the hundreds
position, and 2 in the thousand positions and the value will be written as:
(2×1000) + (5×100) + (4×10) + (1×1)
(2×103) + (5×102) + (4×101) + (1×100)
2000 + 500 + 40 + 1
2541
Octal Number System
The octal number system has base 8(means it has only eight digits from 0
to 7). There are only eight possible digit values to represent a number.
With the help of only three bits, an octal number is represented. Each set
of bits has a distinct value between 0 and 7.
Below, we have described certain characteristics of the octal number
system:
Characteristics:
1. An octal number system carries eight digits starting from 0, 1, 2, 3,
4, 5, 6, and 7.
2. It is also known as the base 8 number system.
3. The position of a digit represents the 0 power of the base(8).
Example: 80
4. The position of the last digit represents the x power of the base(8).
Example: 8x, where x represents the last position, i.e., 1
Number Octal Number
2
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
Examples:
(273)8, (5644)8, (0.5365)8, (1123)8, (1223)8.
Hexadecimal Number System
It is another technique to represent the number in the digital system
called the hexadecimal number system. The number system has a
base of 16 means there are total 16 symbols(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A,
B, C, D, E, F) used for representing a number. The single-bit
representation of decimal values10, 11, 12, 13, 14, and 15 are
represented by A, B, C, D, E, and F. Only 4 bits are required for
representing a number in a hexadecimal number. Each set of bits has a
distinct value between 0 and 15. There are the following characteristics of
the octal number system:
Characteristics:
1. It has ten digits from 0 to 9 and 6 letters from A to F.
2. The letters from A to F defines numbers from 10 to 15.
3. It is also known as the base 16number system.
4. In hexadecimal number, the position of a digit represents the 0
power of the base(16). Example: 160
5. In hexadecimal number, the position of the last digit represents the
x power of the base(16). Example: 16 x, where x represents the last
position, i.e., 1
Binary Number Hexadecimal Number
0000 0
0001 1
0010 2
0011 3
0100 4
3
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F
Examples:
(FAC2)16, (564)16, (0ABD5)16, (1123)16, (11F3)16.
Radix Conversion in Digital Electronics
In positional number systems, the radix is the total number of unique
digits that are used to represent numbers in that number system. Radix is
also called Base. For example, in decimal number system, we use total
ten digits from 0 to 9 (i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) to represent any
decimal number. Therefore, for the decimal number system, the radix or
base is ten (10).
Although we can easily convert a given number from one radix (i.e.
number system) to any other radix (number system) by using radix
conversion protocols. In this article, we will understand the radix
conversion with the help of examples. But before that let us first know
briefly about the four most common types of number systems.
Decimal Number System − The radix or base of the decimal number
system is ten (10), thus it has 10 unique digits from 0 to 9 to represent
different numbers. Decimal number system is the most common in human
calculations.
Binary Number System − The radix or base of the binary number
system is two (2). Thus, binary number system has only two digits 0 and
1. Each binary digit is called a bit. Binary number system is the
extensively used in digital system design.
Octal Number System − The radix or base of the octal number
system is eight (8). Therefore, octal number system has eight digits from
0 to 7 to represent octal numbers. It is also used in digital systems.
4
Hexadecimal Number System Example 3 m − The radix or base of
the hexadecimal number system is sixteen (16). Hence, hexadecimal
number system contains total 16 unique digits from 0 to 15, where, 0 to 9
are used as in the decimal number system, but 10 to 15 are denoted by a
character, i.e., 10 = A, 11 = B, 12 = C, 13 = D, 14 = E, 15 = F. It number
system is also used in electronic system such as microcontrollers.
Discuss in detail the following types of conversion −
Decimal to Binary Conversion
Binary to Decimal Conversion
Decimal to Octal Conversion
Octal to Decimal Conversion
Decimal to Hexadecimal Conversion
Hexadecimal to Decimal Conversion
Binary to Octal Conversion
Octal to Binary Conversion
Binary to Hexadecimal Conversion
Hexadecimal to Binary Conversion
Decimal to Binary Conversion
We can convert a number given in the decimal number system into its
corresponding number in the binary number system. There are two
methods to convert a number from decimal number system to binary
number system, namely sum of weights method and double-dabble
method.
In the sum of weights method, the set of binary weight values whose sum
is equal to the given decimal number is determined. This method is
suitable only for small numbers, because in this method, we need to
remember the values of various powers of 2.
In the double-dabble method, the decimal integer number is converted
into an equivalent binary integer number by successive division by 2, and
the fractional part of the decimal number is converted into equivalent
binary fractional number by successive multiplication by 2.
Now, let us understand these two methods of decimal to binary
conversion with the help of solved examples.
Convert ⟮165⟯10⟮165⟯10 to its equivalent binary number.
Example 1
Given decimal number is ⟮165⟯10⟮165⟯10.
Solution
Sum-of-Weights Method − The largest decimal number, which is a
power of 2, and not exceeding 165 is 128,
128=27=⟮10000000⟯2128=27=⟮10000000⟯2
The remainder is,
165−128=37165−128=37
Now, the largest decimal number, which is a power of 2 and not exceeding
37 is 32,
5
32=25=⟮100000⟯232=25=⟮100000⟯2
The remainder is,
37−32=537−32=5
The largest decimal number, which is a power of 2 and not exceeding 5 is
4,
4=22=⟮100⟯24=22=⟮100⟯2
The remainder is,
5−4=15−4=1
Finally,
1=20=⟮1⟯21=20=⟮1⟯2
⟮165⟯10=⟮10000000⟯2+⟮100000⟯2+⟮100⟯2+⟮1⟯2=⟮10100101⟯2⟮165⟯10=⟮100
Therefore,
00000⟯2+⟮100000⟯2+⟮100⟯2+⟮1⟯2=⟮10100101⟯2
This process can also be represented as,
Binary Weights 27 26 25 24 23 22 21 20
Binary Weight Values 128 64 32 16 8 4 2 1
Bit 1 0 1 0 0 1 0 1
Double-Dabble Method − In this method, we will divide the given
decimal number successively by 2 and read the remainders upwards to
obtain the equivalent binary number.
Divisor Number Remainder
2 165 1
2 82 0
2 41 1
2 20 0
2 10 0
2 5 1
2 2 0
2 1 1
2 0
is ⟮165⟯10=⟮10100101⟯2⟮165⟯10=⟮10100101⟯2.
Reading the remainders from bottom to top, the equivalent binary number
Binary to Decimal Conversion
We can convert a given binary number into its equivalent decimal number
by using the positional weights method. In the positional weight method,
6
each bit of the binary number is multiplied by its position weight and the
product terms are then added together to get the decimal number.
Convert ⟮101101⟯2⟮101101⟯2 into its equivalent decimal number.
Example 2
Given binary number is ⟮101101⟯2⟮101101⟯2.
Solution
Binary digits 1 0 1 1 0 1
Positional weights 25 24 23 22 21 20
Positional weights (1×25) (1×24) (1×23) (1×22) (1×21) (1×20)
32 0 8 4 0 1
⟮101101⟯2=32+0+8+4+0+1=⟮45⟯10⟮101101⟯2=32+0+8+4+0+1=⟮45⟯10
Hence, the equivalent decimal number will be,
Decimal to Octal Conversion
We can covert a given decimal number into its equivalent octal number by
successive division of the given number by 8 till the quotient is 0. Then,
the octal number is obtained by reading the remainders upwards.
Example 3
Convert (370)10(370)10 to equivalent octal number.
Solution
Given decimal number is (370)10(370)10.
Divisor Number Remainder
8 370 2
8 46 6
8 5 5
is ⟮370⟯10=⟮562⟯8⟮370⟯10=⟮562⟯8.
Reading the remainders from bottom to top, the equivalent octal number
Octal to Decimal Conversion
We can convert a given octal number into its equivalent decimal number
by multiplying each digit in the octal number by the weight of its position
and adding all the product terms.
Convert ⟮4050⟯8⟮4050⟯8to equivalent decimal number.
Example 4
The given octal number is ⟮4050⟯8⟮4050⟯8.
Solution
Octal digits 4 0 5 0
Positional weights 83 82 81 80
Multiplying (4 × 83) (0 × 82) (5 × 81) (0 × 80)
7
2048 0 40 0
⟮4050⟯8=2048+0+40+0=⟮2088⟯10⟮4050⟯8=2048+0+40+0=⟮2088⟯10
Therefore, the equivalent decimal number will be,
Decimal to Hexadecimal Conversion
We can convert a decimal number into its equivalent hexadecimal number
by successively dividing the given decimal number by 16 till the quotient
is zero. Then, the remainders are to be read from bottom to top to obtain
equivalent hexadecimal number.
Convert ⟮2590⟯10⟮2590⟯10 to its equivalent hexadecimal number.
Example 5
Divisor Number Remainder
16 2590 14 E
16 161 1 1
16 10 10 A
number is ⟮2590⟯10=⟮E1A⟯16⟮2590⟯10=⟮�1�⟯16.
Reading the remainders from bottom to top, the equivalent hexadecimal
Hexadecimal to Decimal Conversion
We can covert a given hexadecimal number to its equivalent decimal
number by multiplying each digit of the hexadecimal number by its
position weight and then add all the product terms to get the equivalent
decimal number.
Convert ⟮5B7⟯16⟮5�7⟯16 to its equivalent decimal number.
Example 6
The given hexadecimal number is ⟮5B7⟯16⟮5�7⟯16.
Solution
Hex digits 5 B (10) 7
Positional weights 162 161 160
Multiplying (5 ×162) (10×161) (7×160)
1280 160 7
⟮5B7⟯16=1280+160+7=⟮1447⟯10⟮5B7⟯16=1280+160+7=⟮1447⟯10
Therefore, the equivalent decimal number will be,
Binary to Octal Conversion
8
An octal digit is equivalent to a group of 3 binary bits. Hence, by using this
relation, we can directly convert a binary number into the equivalent octal
number. Hence, we convert a binary number into an equivalent octal
number by making groups of 3 bits each, and then by replacing each 3 bit
binary group by its equivalent octal digit.
Convert ⟮101101⟯2⟮101101⟯2 to its equivalent octal number.
Example 7
The given binary number is ⟮101101110⟯2⟮101101110⟯2.
Solution
Groups of 3-bits 101 101 110
Octal equivalent 5 5 6
⟮101101110⟯2=⟮556⟯8⟮101101110⟯2=⟮556⟯8
Therefore, the equivalent octal number is,
Octal to Binary Conversion
We can easily convert an octal number into its equivalent binary number
just by replacing each octal digit by its 3-bit binary equivalent.
Convert ⟮366⟯8⟮366⟯8 to its equivalent binary number.
Example 8
The given octal number is ⟮366⟯8⟮366⟯8.
Solution
Octal number 3 6 6
Equivalent 3-bit binary 011 110 110
⟮366⟯8=⟮011110110⟯2⟮366⟯8=⟮011110110⟯2
Therefore, the equivalent binary number is,
Binary to Hexadecimal Conversion
A hexadecimal digit is equivalent to a group of 4 binary bits. This
relationship can be used to convert a binary number to its equivalent
hexadecimal number. Thus, in order to convert a given binary number to
equivalent hexadecimal number, we make groups of 4 bits each, and
replace each 4-bit binary group by the equivalent hexadecimal digit.
Convert ⟮101011011⟯2⟮101011011⟯2 to
Example 9
the equivalent hexadecimal
number.
The given binary number is ⟮101011011⟯2⟮101011011⟯2.
Solution
Groups of 4-bits 0001 0101 1011
Hex equivalent 1 5 B (11)
⟮101011011⟯2=⟮15B⟯16⟮101011011⟯2=⟮15�⟯16
Therefore, the equivalent hexadecimal number is,
Hexadecimal to Binary Conversion
9
We can simply convert a hexadecimal number to equivalent binary
number just by replacing each digit in the given hexadecimal number by
its 4-bit binary group.
Convert ⟮5C8⟯16⟮5�8⟯16 to equivalent binary number.
Example 10
The given number is ⟮5C8⟯16⟮5�8⟯16.
Solution
Hex number 5 C (12) 8
Equivalent 4-bit binary 0101 1100 1000
⟮5C8⟯16=⟮010111001000⟯2
Therefore, the equivalent binary number is,
For finding the subtraction of the number base system, the complements
are used. If r is the base of the number system, then there are two types
of complements that are possible, i.e., r's and (r-1)'s. We can find the r's
complement, and (r-1)'s complement of the number, here r is the radix.
The r's complement is also known as Radix complement (r-1)'s
complement, is known as Diminished Radix complement.
If the base of the number is 2, then we can find 1's and 2's complement of
the number. Similarly, if the number is the octal number, then we can find
7's and 8's complement of the number.
There is the following formula for finding the r's and (r-1)'s complement:
r' s= complement=(rn )10-N
(r-1)' s complement={(r )10-1}-N
n
Backward Skip 10sPlay VideoForward Skip 10s
In the above formulas,
o The n is the number of digits in the number.
o The N is the given number.
o The r is the radix or base of the number.
Advantages of r's complement
These are the following advantages of using r's complement:
o In r's complement, we can further use existing addition circuitry
means there is no special circuitry.
10
o There is no need to determine whether the minuend and subtrahend
are larger or not because the result has the right sign automatically.
o The negative zeros are eliminated by r's complement.
Let's take some examples to understand how we can calculate the r's and
(r-1)'s complement of binary, decimal, octal, and hexadecimal numbers.
Example 1: (1011000)2
This number has a base of 2, which means it is a binary number. So, for
the binary numbers, the value of r is 2, and r-1 is 2-1=1. So, we can
calculate the 1's and 2's complement of the number.
1's complement of the number 1011000 is calculated as:
ADVERTISEMENT
={(27 )10-1}-(1011000)2
={(128)10-1}-(1011000)2
={(127)10}-(1011000)2
=11111112-10110002
=0100111
2's complement of the number 1011000 is calculated as:
=(27 )10-(1011000)2
=(128)10-(1011000)2
=100000002-10110002
=01010002
Example 2: (155)10
This number has a base of 10, which means it is a decimal number. So, for
the decimal numbers, the value of r is 10, and r-1 is 10-1=9. So, we can
calculate the 10's and 9's complement of the number.
9's complement of the number 155 is calculated as:
={(103 )10-1}-(155)10
=(1000-1)-155
=999-155
=(844)10
10's complement of the number 1011000 is calculated as:
=(103 )10-(15510
=1000-155
=(845)10
11
Example 3: (172)8
12