Friday, 29 September 2017

EDC : UNIT VI : CODES : Classification



#CODES#
Classification of binary codes
1.   Weighted Codes
2.   Non-Weighted Codes
3.   Self Complementing Code
4.   Straight binary codes
5.   Alphanumeric Codes
6.   Gray Code
7.   Binary Coded Decimal (BCDcode)
Weighted codes 
Weighted  codes are those in which each position of number represents a fixed weight ex.8421,hex,octal. Weighted binary codes are those binary codes which obey the positional weight principle. Each position of the number represents a specific weight. Several systems of the codes are used to express the decimal digits 0 through 9. In these codes each decimal digit is represented by a group of four bits.for weighted code specific weight is associated with each bit. for base b,         
        bit position    associated weight
                   0                     b^0=1
                   1                     b^1
                   2                     b^2
                   3                     b^3
EX:Weighted  codes
for example hexadecimal has b=16, to convert a hexadecimal number into decimal you just need to multiply each bit with its positional weight. ex. 1A21h =
1*16^3 +  A*16^2  +  2*16^1  +  1*16^0 = 6689
Non-weighted codes
Non-weighted codes are not positional weighted,each position with in the number is not assigned to a fixed value. Examples of non- weighted code are ASCCI, Gray code.
EX:Non Weighted  codes
 For Non weighted code take the example of Excess-3 code ,if 1010 is in excess-3 then to convert it into binary subtract it from 3 that is 1010-0011=0111
Self Complementing Code
The 2421, the excess3 and the 84-2-1 codes are examples of selfcomplementing codes. Such codes have the property that the 9's complement of a decimal number is obtained directly by changing 1's to 0's and 0's to 1's (i.e., by complementing each bit in the pattern).
Straight binary codes
In this code each decimal digit is represented by a 4-bit binary number. BCD is a way to express each of the decimal digits with a binary code. In the BCD, with four bits we can represent sixteen numbers (0000 to 1111). But in BCD code only first ten of these are used (0000 to 1001).
Alphanumeric codes
A binary digit or bit can represent only two symbols as it has only two states '0' or '1'. But this is not enough for communication between two computers because there we need many more symbols for communication. These symbols are required to represent 26 alphabets with capital and small letters, numbers from 0 to 9, punctuation marks and other symbols.The alphanumeric codes are the codes that represent numbers and alphabetic characters. Mostly such codes also represent other characters such as symbol and various instructions necessary for conveying information. An alphanumeric code should at least represent 10 digits and 26 letters of alphabet i.e. total 36 items. The following three alphanumeric codes are very commonly used for the data representation.American Standard Code for Information Interchange A S C I I.Extended Binary Coded Decimal Interchange Code E B C D I C.ASCII code is a 7-bit code whereas EBCDIC is an 8-bit code. ASCII code is more commonly used worldwide while EBCDIC is used primarily in large IBM computers.
Gray Code
It is the non-weighted code and it is not arithmetic codes. That means there are no specific weights assigned to the bit position. It has a very special feature that, only one bit will change each time the decimal number is incremented as shown in fig. As only one bit changes at a time, the gray code is called as a unit distance code. The gray code is a cyclic code. Gray code cannot be used for arithmetic operation.
Application of Gray code
Gray code is popularly used in the shaft position encoders.A shaft position encoder produces a code word which represents the angular position of the shaft.
Binary Coded Decimal (BCDcode)
In this code each decimal digit is represented by a 4-bit binary number. BCD is a way to express each of the decimal digits with a binary code. In the BCD, with four bits we can represent sixteen numbers 0000 to 1111. But in BCD code only first ten of these are used 0000 to 1001. The remaining six code combinations i.e. 1010 to 1111 are invalid in BCD.
Advantages of BCD Codes
It is very similar to decimal system.We need to remember binary equivalent of decimal numbers 0 to 9 only.
Disadvantages of BCD Codes
The addition and subtraction of BCD have different rules.The BCD arithmetic is little more complicated. BCD needs more number of bits than binary to represent the decimal number. So BCD is less efficient than binary.
 


 

 

         






1 comment:

Master said...

Information is useful,
It will be more useful if ASCII table is added.

Tricks

Halogen Derivatives and Alcohol, Phenol, Ether

  Pathak’s Academy Spectrum 2024 Topics : Chapters 10,11 Marks: 25                                                                          ...