6
Digital Electronics
1.8.2 1’s Complement
In the 1’s complement format, the positive numbers remain unchanged. The negative numbers are
obtained by taking the 1’s complement of the positive counterparts. For example, +9 will be represented
as 00001001 in eight-bit notation, and −9 will be represented as 11110110, which is the 1’s complement
of 00001001. Again, n-bit notation can be used to represent numbers in the range from −(2
n−1
− 1)
to +(2
n−1
− 1) using the 1’s complement format. The eight-bit representation of the 1’s complement
format can be used to represent decimal numbers in the range from −127 to +127.
1.8.3 2’s Complement
In the 2’s complement representation of binary numbers, the MSB represents the sign, with a ‘0’
used for a plus sign and a ‘1’ used for a minus sign. The remaining bits are used for representing
magnitude. Positive magnitudes are represented in the same way as in the case of sign-bit or 1’s
complement representation. Negative magnitudes are represented by the 2’s complement of their
positive counterparts. For example, +9 would be represented as 00001001, and −9 would be written
as 11110111. Please note that, if the 2’s complement of the magnitude of +9 gives a magnitude of −9,
then the reverse process will also be true, i.e. the 2’s complement of the magnitude of −9 will give a
magnitude of +9. The n-bit notation of the 2’s complement format can be used to represent all decimal
numbers in the range from +(2
n−1
− 1) to −(2
n−1 . The 2’s complement format is very popular as it is
very easy to generate the 2’s complement of a binary number and also because arithmetic operations
are relatively easier to perform when the numbers are represented in the 2’s complement format.
1.9 Finding the Decimal Equivalent
The decimal equivalent of a given number in another number system is given by the sum of all
the digits multiplied by their respective place values. The integer and fractional parts of the given
number should be treated separately. Binary-to-decimal, octal-to-decimal and hexadecimal-to-decimal
conversions are illustrated below with the help of examples.
1.9.1 Binary-to-Decimal Conversion
The decimal equivalent of the binary number (1001.0101) 2 is determined as follows:
• The integer part = 1001
• The decimal equivalent = 1 × 2
0
+ 0 × 2
1
+ 0 × 2
2
+ 1 × 2
3
= 1 + 0 + 0 + 8 = 9
• The fractional part = .0101
• Therefore, the decimal equivalent = 0 × 2
−1
+ 1 × 2
−2
+ 0 × 2
−3
+ 1 × 2
−4
= 0 + 0.25 + 0
+ 0.0625 = 0.3125
• Therefore, the decimal equivalent of (1001.0101) 2 = 9.3125
1.9.2 Octal-to-Decimal Conversion
The decimal equivalent of the octal number (137.21) 8 is determined as follows:
• The integer part = 137
• The decimal equivalent = 7 × 8
0
+ 3 × 8
1
+ 1 × 8
2
= 7 + 24 + 64 = 95
Précédent

- 28/741

Suivant