BINARY CODES



There are four types of  binary codes. They are:

     a. BCD code
     b. Excess-3 code
     c. Gray code
     d. Parity bit.

=>BCD Code 

  1. Here BCD means “Binary Coded Decimal”.

  2. In  BCD code we have to write the binary form for each and every digit in the given               number.

  3.  For example:-  Given number is 125.

  4. To write the binary code for 125 we have to write the binary form for each digit in 125 as       shown below.
      Solution:
                                  1                     2                     5
                                   1                    2                    5

                               0001                0010               0101    

      If we write 125 in binary form we get : 1111101.

  NOTE:-
  • From  the  above example there are 12 bits in BCD form whereas there are 7 bits in binary form. 
  • Therefore, the BCD code consists of more number of bits than binary code. 
  • Therefore, the BCD code is less efficient than the binary number system.
  • The BCD code is also known as 8 – 4 – 2 – 1.
  • 8-4-2-1 can be represented as shown in the following table.



           
            4
           2
            1
           0
            0
            0
           0
            0
           1
            0
            0       
           0
            1
           2
            0
            0
           1
            0
           3
            0
            0
           1
            1
           4
            0
            1
           0
            0
           5 
            0 
            1
           0
            1
           6
            0
            1
           1
            0
           7
            0
            1
           1
            1
           8
            1
            0
           0
            0
           9
            1
            0 
           0
            1  



=>Excess-3 Code 

    1. In excess-3 code we have to add 3 to every binary number.

    2. The excess-3 code for decimal numbers is as shown in the following table

              DECIMAL
              BINARY
            EXCESS-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


=>GRAY CODE

    1. In gray code the successive code or the consecutive binary code will differ in one bit             only.

     2. The gray code for decimal numbers is as shown in the following table
              DECIMAL
              BINARY
           GRAY CODE
                    0
                 0000
                 0000
                    1
                 0001
                 0001
                    2
                 0010  
                 0011
                    3
                 0011
                 0010
                    4
                 0100
                 0111
                    5
                 0101
                 0110
                    6
                 0110
                 0101
                    7      
                 0111
                 0100


=>PARITY BIT

  1. By using parity bit we can check whether the given number is received correctly or not.

  2. The parity bits are of two types .They are:-

                a. Even parity
                b. Odd parity.

 3. When we give the even parity along with input message then if the number of one’s              present are even then it is known as even parity.

 4. When we give the input message along with odd parity and if the number of one’s are            odd then it is known as odd parity. 


               INPUT
          EVEN PARITY
          ODD PARITY
                 000
                    0
                    1
                 001
                    1
                    0
                 010
                    1
                    0
                 011
                    0
                    1
                 100
                    1
                    0
                 101
                    0
                    1
                 110
                    0
                    1
                 111 
                    1
                    0
  

NEXT TOPIC:  LOGIC  GATES