CL11 Notes Mod1.1
CL11 Notes Mod1.1
NUMBER SYSTEMS
1. Decimal Number System - In Decimal Number System, the base is 10. It means that
the maximum number of individual representations in this number system is 10. The digits
are 0,1,2,3,4,5,6,7,8,9. The maximum value is 9 and the minimum value is 0.
A number represented in Decimal Number system will e having the subscript 10 as the
base indication. E.g., 23410, 1210
2. Binary Number System – In Binary Number System, the base is 2. It uses only two
distinct symbols – 0 and 1. The absence of an electronic pulse (input) is represented using
0 whereas the presence of an electronic pulse is represented using 1. A binary digit is
called a bit. A representation in binary has a sequence of bits. A binary pointer separates
integer and fractional parts.
A number in Binary Number System will be having the base indication 2 as subscript.
E.g., 110112, 11000112
3. Octal Number System – In Octal Number System, the base is 8. The independent
symbols in Octal number system are 0,1,2,3,4,5,6,7. the maximum value is 7 and the
minimum value is 0. A number that belongs to the octal representation can be identified
using the subscript representation of 8. E.g., 1238, 2348
4. Hexadecimal Number System – In Hexadecimal Number System, the base is 16. The
values included in Hexadecimal number system are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D,
E, F. The numbers represented in hexadecimal number system is identified using the radix
16. E.g., A1216, 124F16.
3 2. 1 2 6
So, the equivalent octal number is 32.1268
BCD or Binary Coded Decimal is a coding scheme used to represent decimal number (0 to 9) in
the form of binary digits of a group of 4-bits. Binary coded decimal is the simplest form to convert
decimal numbers into their equivalent binary format. Although, binary coded decimal or BCD is
not the same as the normal binary representation.
In binary coded decimal (BCD) coding scheme, each decimal digit is represented as a group of 4-
bit binary number. For a multi-digit decimal number, each digit of the decimal number is encoded
separately in the BCD.
As we know, a 4-bit binary number can represent 16 decimal digits, but in binary coded decimal,
BCD codes 1010, 1011, 1100, 1101, 1110, and 1111 equivalent to decimal 10, 11, 12, 13, 14, and
15 are considered illegal combinations.
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
The following example shows how a decimal number is converted to a BCD code −
Convert (125)10 into its equivalent binary coded decimal (BCD) code.
Decimal number 1 2 5
BCD Weights 8 4 2 1 8 4 2 1 8 4 2 1
BCD Code 0 0 0 1 0 0 1 0 0 1 0 1
Hence, the binary coded decimal for (125)10 is (0001 0010 0101).
BCD ADDITION
o Step 1 − Perform addition of two BCD numbers by following the rules of binary addition.
o Step 2 − If the result or sum is a 4-bit binary number which is less than or equal to 9, then
the sum is a valid BCD number.
o Step 3 − If the sum is a 4-bit number that is greater than 9 or if a carry is generated, then
it is an invalid sum.
o Step 4 − To obtain the corrected result/sum, add 6 (0110) to the 4-bit invalid sum. If a
carry is generated when 6 is added, then propagate and add this carry to the next 4-bit
group. This step is done to skip the six illegal BCD codes (i.e. 1010, 1011, 1100, 1101,
1110, and 1111).
0 0 0 + 0 = 0; no carry
0 1 0 + 1 = 1; no carry
1 0 1 + 0 = 1; no carry
1 1 1 + 1 = 0; carry = 1
30 0011 0000
+ 15 + 0001 0101
45 0100 0101
+1 1 1
Error detection codes are used to detect the error(s) present in the received data (bit stream).
These codes contain some bit(s), which are included (appended) to the original bit stream.
These codes detect the error, if it is occurred during transmission of the original data (bit
stream).
Example − Parity code, Hamming code.
Error correction codes are used to correct the error(s) present in the received data (bit stream)
so that, we will get the original data. Error correction codes also use the similar strategy of
error detection codes.
Example − Hamming code.
Therefore, to detect and correct the errors, additional bit(s) are appended to the data bits at the
time of transmission.
Parity Code
It is easy to include (append) one parity bit either to the left of MSB or to the right of LSB of
original bit stream. There are two types of parity codes, namely even parity code and odd
parity code based on the type of parity being chosen.
The value of even parity bit should be zero, if even number of ones present in the binary code.
Otherwise, it should be one. So that, even number of ones present in even parity code. Even
parity code contains the data bits and even parity bit.
The following table shows the even parity codes corresponding to each 3-bit binary code.
Here, the even parity bit is included to the right of LSB of binary code.
Binary Code Even Parity Bit Even Parity Code
000 0 0000
001 1 0011
010 1 0101
011 0 0110
100 1 1001
101 0 1010
110 0 1100
111 1 1111
Here, the number of bits present in the even parity codes is 4. So, the possible even number of
ones in these even parity codes are 0, 2 & 4.
If the other system receives one of these even parity codes, then there is no error in
the received data. The bits other than even parity bit are same as that of binary code.
If the other system receives other than even parity codes, then there will be an error(s)
in the received data. In this case, we can’t predict the original binary code because we
don’t know the bit position(s) of error.
Therefore, even parity bit is useful only for detection of error in the received parity code. But,
it is not sufficient to correct the error.
The value of odd parity bit should be zero, if odd number of ones present in the binary code.
Otherwise, it should be one. So that, odd number of ones present in odd parity code. Odd
parity code contains the data bits and odd parity bit.
The following table shows the odd parity codes corresponding to each 3-bit binary code.
Here, the odd parity bit is included to the right of LSB of binary code.
000 1 0001
001 0 0010
010 0 0100
011 1 0111
100 0 1000
101 1 1011
110 1 1101
111 0 1110
Here, the number of bits present in the odd parity codes is 4. So, the possible odd number of
ones in these odd parity codes are 1 & 3.
If the other system receives one of these odd parity codes, then there is no error in the
received data. The bits other than odd parity bit are same as that of binary code.
If the other system receives other than odd parity codes, then there is an error(s) in the
received data. In this case, we can’t predict the original binary code because we don’t
know the bit position(s) of error.
Therefore, odd parity bit is useful only for detection of error in the received parity code. But it
is not sufficient to correct the error.
Hamming Code
Hamming code is useful for both detection and correction of error present in the received data.
This code uses multiple parity bits and we have to place these parity bits in the positions of
powers of 2.
The minimum value of 'k' for which the following relation is correct (valid) is nothing but the
required number of parity bits.
2k≥n+k+12k≥n+k+1 where,
'n' is the number of bits in the binary code (information)
'k' is the number of parity bits
Therefore, the number of bits in the Hamming code is equal to n + k.
Let the Hamming code is bn+kbn+k−1.....b3b2b1bn+kbn+k−1.....b3b2b1 & parity
bits pk,pk−1,....p1pk,pk−1,....p1. We can place the 'k' parity bits in powers of 2 positions only.
In remaining bit positions, we can place the ‘n’ bits of binary code.
Based on requirement, we can use either even parity or odd parity while forming a Hamming
code. But the same parity technique should be used in order to find whether any error present
in the received data.
Follow this procedure for finding parity bits.
Find the value of p1, based on the number of ones present in bit positions b3, b5, b7 and
so on. All these bit positions (suffixes) in their equivalent binary have ‘1’ in the place
value of 20.
Find the value of p2, based on the number of ones present in bit positions b3, b6, b7 and
so on. All these bit positions (suffixes) in their equivalent binary have ‘1’ in the place
value of 21.
Find the value of p3, based on the number of ones present in bit positions b5, b6, b7 and
so on. All these bit positions (suffixes) in their equivalent binary have ‘1’ in the place
value of 22.
Similarly, find other values of parity bits.
Follow this procedure for finding check bits.
Find the value of c1, based on the number of ones present in bit positions b1, b3, b5,
b7 and so on. All these bit positions (suffixes) in their equivalent binary have ‘1’ in the
place value of 20.
Find the value of c2, based on the number of ones present in bit positions b2, b3, b6,
b7 and so on. All these bit positions (suffixes) in their equivalent binary have ‘1’ in the
place value of 21.
Find the value of c3, based on the number of ones present in bit positions b4, b5, b6,
b7 and so on. All these bit positions (suffixes) in their equivalent binary have ‘1’ in the
place value of 22.
Similarly, find other values of check bits.
The decimal equivalent of the check bits in the received data gives the value of bit position,
where the error is present. Just complement the value present in that bit position. Therefore, we
will get the original binary code after removing parity bits.