Many number systems are used in digital technology. The most common are binary, octal, decimal, hexadecimal system.

A number system with base b will have b different digits ranging from 0 to b-1

For example in a decimal number system with base 10 will have digits ranging from 0 to 10-1=9.

|They are 0,1,2,3,4,5,6,7,8,9.

**Weighted Number system:**

i) It is a positional weight system.

ii) Ex. Binary, Octal, Decimal, Hexadecimal, 2421, etc..

**Unweighted number System:**

i) It is a non-positional weightage system

ii) Ex. Gray code, Excess 3 code, etc..

Number System | Base (b) | Digits |

Binary | 2 | 0,1 |

Octal | 8 | 0,1,2,3,4,5,6,7 |

Decimal | 10 | 0,1,2,3,4,5,6,7,8,9 |

Hexadecimal | 16 | 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F |

Note : In positional weightage system, the position of each digit of a number has some positional weightage.

**Codes**

**Binary Coded Decimal (BCD)**

Each digit of a decimal number is represented by the binary equivalent.*In 4-bit binary formats*:

Total number of possible representation = 2^{4} = 16

Valid BCD codes = 10

Invalid DBC code = 6*In 8-bit binary formats :*

Total number of possible representation = 2^{8} = 256

Valid BCD codes = 100

Invalid DBC code = 256-100 = 156

Note: During arithmetic operation if invalid BCD is obtained then add (0110) to get correct result

**Excess 3-code**

It is a 4-bit code and can be derived from BCD code by adding 3 to each coded number.

It is a self-complementing code

**Gray-code**

Also called minimum distance code in which only 1 bit of the code group changes when going from one step to the other.

Gray code is a minimum error code

**Binary-to-Gray conversion**

MSB in the gray code is the same as the corresponding digit in the binary number.

Starting from Left to right add each adjacent pair of the binary digit to get next and gray code digit. (Discard the carry if generated).

**Grey-to-Binary conversion**

MSB of binary is the same as that of grey code

Add each binary digit to the generated grey digit in the next adjacent position (discard the carry if generated)

In self complementing code, the sum of weightage = 9, Ex : 2421 code, 84-2-1 code etc,..

The largest number that can be represented by N-bits is (2^{N}-1)_{10}

** BCD to Excess 3 code** Conversion Table

Input BCD A B C D | Output Excess-3 code [ BCD + 0011 = excess 3 code] W X Y Z |

0 0 0 0 | 0 0 1 1 |

0 0 0 1 | 0 1 0 0 |

0 0 1 0 | 0 1 0 1 |

0 0 1 1 | 0 1 1 0 |

0 1 0 0 | 0 1 1 1 |

0 1 0 1 | 1 0 0 0 |

0 1 1 0 | 1 0 0 1 |

0 1 1 1 | 1 0 1 0 |

1 0 0 0 | 1 0 1 1 |

1 0 0 1 | 1 1 0 0 |