n- Bit binary
code consists of n-bits that assumes up to 2

^{n}combinations.**BCD Code:**

0-9 (all decimal numbers) are the digits present in the BCD code.- Each decimal digit is represented in 4-bits.

**Weighted-code:**

In a weighted code each bit position is assigned a weight such that
decimal equivalent number can be obtained by adding weights of bit positions
containing 1’s.

Ex: 2-4-2-1 code

__1001__in 2-4-2-1 code is 2+0+0+1=3

2421: weights

**Non-weighted code:**

Non- weighted codes will not have weighting factor for each bit
position.

Ex: excess-3 code

**Self-Complementing code:**

A code in which 9’s complement of a number can be obtained by simply
inverting each bit in the given code.

Ex: 2-4-2-1 code, excess-3 code

- 456 in excess-3 code is 0111 1000 1001
- Complementing each bit 1000 0111 0110 which is 543 in excess-3 code.
- 9’s complement of 456 is 543. Hence excess-3 code is self-complementing code.

**Gray code:**

- In gray code only one bit changes when going from one number to immediate next number.

0

__0__1- Gray code for 1

0

__1__1- Gray code for 2 (only change in one bit position).

- Gray code belongs to reflected codes. K-bit gray code can be obtained by reflecting k-1 bit gray code and prefixing ‘0’ for top code words and ‘1’ for bottom code words.

__Obtaining 2-bit gray code from 1-bit gray code:__

__Binary to Gray code conversion:__

Ex: B

_{3}B_{2}B_{1}B_{0}= 0 1 0 1 (binary code)
G

_{3}G_{2}G_{1}G_{0}= 0 1 1 1 (Gray code)
G

_{3}=B_{3}, G_{2}=B_{3}xor B_{2}, G_{1}=B_{2}xor B_{1}, G_{0}= B_{1}xor B_{0}__Gray code to binary conversion:__

Ex: G

_{3}G_{2}G_{1}G_{0}= 0 1 1 1 (Gray code)
B

_{3}B_{2}B_{1}B_{0}= 0 1 0 1 (binary code)
B

_{3}=G_{3}, B_{2}=B_{3}xor G_{2}, B_{1}=B_{2}xor G_{1}, B_{0}= B_{1}xor G_{0}_{}

**ASCII Code:**

- ASCII stands for “American Standard Code for
Information Interchange”
- It uses 7-bit code, to code 128 characters
- ASCII code contains 94 printable characters, and
34 non-printable characters

**EBCDIC Code:**

- EBCDIC stands for “Extended Binary Coded Decimal Interchange Code”
- It was used in IBM main frame computers.
- It uses 8-bit code to represent a character.

## No comments:

## Post a Comment