The main characteristic of a weighted code is, each binary bit is assigned by a “weight” and values depend on the position of the binary bit.
The sum of the weights of these binary bits, whose value is 1 is equal to the decimal digit which they represent.
In other words, if w1, w2, w3 and w4 are the weights of the binary digits, and x1, x2, x3 and x4 are the corresponding bit values, then the decimal digit N=w4x4 + w3x3+w2x2+w1x1 is represented by the binary sequence x4x3x2x1.
A sequence of binary bits which represents a decimal digit is called a “code word”.
Thus x4x3x2x1 is a code word of N.
Example of these codes is: BCD, 8421, 6421, 4221, 5211, 3321 etc.
Weighted codes are used in:
a) Data manipulation during arithmetic operation.
b) For input/output operations in digital circuits.
c) To represent the decimal digits in calculators, volt meters etc.
Non-weighted or un-weighted codes are those codes in which the digit value does not depend upon their position i.e., each digit position within the number is not assigned fixed value.
Examples of non-weighted codes are: Un-weighted BCD code, Excess-3 code and gray code.
Non weighted codes are used in:
a) To perform certain arithmetic operations.
b) Shift position encodes.
c) Used for error detecting purpose.