Vous êtes sur la page 1sur 3

Binary Codes

In the coding, when numbers, letters or words are represented by a specific group of symbols,
it is said that the number, letter or word is being encoded. The group of symbols is called as a
code. The digital data is represented, stored and transmitted as group of binary bits. This
group is also called as binary code. The binary code is represented by the number as well as
alphanumeric letter.

Advantages of Binary Code

Following is the list of advantages that binary code offers:

 Binary codes are suitable for the computer applications.


 Binary codes are suitable for the digital communications.
 Binary codes make the analysis and designing of digital circuits if we use the binary
codes.
 Since only 0 & 1 are being used, implementation becomes easy.

Binary Coded Decimal (BCD)

These codes are used to represent decimal numbers in binary form.

Decimal 8421 2421 5211


Digit BCD BCD BCD
0 0000 0000 0000
1 0001 0001 0001
2 0010 0010 0011
3 0011 0011 0101
4 0100 0100 0111
5 0101 1011 1000
6 0110 1100 1010
7 0111 1101 1100
8 1000 1110 1110
9 1001 1111 1111
1010 0101 0010
Unused bit 1011 0110 0100
Combinations 1100 0111 0110
1101 1000 1001
1110 1001 1011
1111 1010 1101

Excess-3 Code: Excess-3 (or XS-3) , is a non-weighted BCD code. The code derives its
name from the fact that each binary code word is the corresponding 8241 code word plus
00112 (310).

Binary BCD XS-3


0 0000 0011
1 0001 0100
2 0010 0101
3 0011 0110
4 0100 0111
5 0101 1000
6 0110 1001
7 0111 1010
8 1000 1011
9 1001 1100

Gray Code: Gray code is a non-weighted code and is not suitable for arithmetic operation. It
is not a BCD code. It is a cyclic code because successive code words in this code differ in one
bit position only, i.e. it is a unit distance code.

Gray Code Decimal Hexadecimal 4-bit


1-bit 2-bit 3-bit 4-bit Binary
0 00 000 0000 0 0 0000
1 01 001 0001 1 1 0001
11 011 0011 2 2 0010
10 010 0010 3 3 0011
110 0110 4 4 0100
111 0111 5 5 0101
101 0101 6 6 0110
100 0100 7 7 0111
1100 8 8 1000
1101 9 9 1001
1111 10 A 1010
1110 11 B 1011
1010 12 C 1100
1011 13 D 1101
1001 14 E 1110
1000 15 F 1111

Classification of binary codes


Weighted codes: In weighted codes, each digit is assigned a specific weight according to its
position. For example, in 8421BCD code, 1001 the weights of 1, 0, 0, 1 (from left to right)
are 8, 4, 2 and 1 respectively.

Suppose W1' W2' W3 and W4 are the weights of binary digits and Xl' X2, X3 and X4 are the
corresponding digit values then decimal digit. N = W1 Xl + W2 X2 + W3 X3 + W4 X4 is
represented by binary sequence X4 X3 X2 X4.
The codes 8421BCD, 2421BCD, 5211BCD are all weighted codes.
• Non-weighted codes: The non-weighted codes are not positionally weighted. In other
words, each digit position within the number is not assigned a fixed value ( or weight ).
Excess-3 and gray code are non-weighted codes.
• Reflective codes: A code is reflective when the code is self complementing. In other words,
when the code for 9 is the complement the code for 0, 8 for 1, 7 for 2, 6 for 3 and 5 for 4.
2421BCD, 5421BCD and Excess-3 code are reflective codes.
• Sequential codes: In sequential codes, each succeeding 'code is one binary number greater
than its preceding code. This property helps in manipulation of data.
8421 BCD and Excess-3 are sequential codes.
• Alphanumeric codes: Codes used to represent numbers, alphabetic characters, symbols and
various instructions necessary for conveying intelligible information.
ASCII, EBCDIC, UNICODE are the most-commonly used alphanumeric codes.
• Error detecting and correcting codes: Codes which allow error detection and correction
are called error detecting and correcting codes. Hamming code is the mostly commonly used
error detecting and correcting code.