| 1. | Computers and other digital systems process data in binary format. |
| 2. | Various binary codes are used to represent data which may be numeric, alphabetic or special characters. |
| 3. | In digital systems, the information is represented in binary form but the interpretation of the data is only possible if the code in which the data is being represented is known. |
| 4. | For example, the binary number 1000001 represents 65 (decimal) in straight binary, 41 (decimal) in BCD, and letter A in ASCII code. |
| 5. | The most commonly used codes are discussed below. |
| 1. | BCD stands for ‘Binary-Coded Decimal’. |
| 2. | In BCD code, four bits are required to code each decimal number as shown in Table 2.1. |
| 3. | For example, (48)10 is represented as 0100 1000 using BCD code, rather than (110000)2. |
| 4. | Since four binary bits are used, the maximum decimal equivalent that may be coded is 1510 (i.e., 11112). |
| 5. | As the maximum decimal digit available is 910, the binary codes 1010, 1011, 1100, 1101, 1110, 1111, representing 10, 11, 12, 13, 14, and 15 in decimal are never being used in BCD code. |
| a. | So these six codes are called forbidden codes and the group of these codes is called the forbidden group in BCD code. |
![]() |
Old computers represented a decimal code in Excess-3 code. |
![]() |
This code assignment is obtained from the corresponding value of 4-bit binary code after adding 3 to the given decimal digit as shown in Table 2.1. |
![]() |
The maximum value is 11002, since the maximum decimal digit is 9 and 3 has to be added to 9 and then get the BCD equivalent. |

| 1. | Gray code belongs to a class of code known as minimum change code, in which a number changes by only one bit as it proceeds from one number to the next. | 2. | Hence this code is not useful for arithmetic operations. | 3. | This code is extensively used in shaft encoders, in some types of analog-to-digital converters, etc. The Gray code may contain any number of bits. | 4. | Table 2.2 shows and example of a 4-bit Gray code. |

| 1. | The MSB of the Gray code is the same as the MSB of the binary number; |
| 2. | The second bit next to the MSB of the Gray code equals the Ex-OR of the MSB and second bit of the binary number; it will be 0 for the same binary bits or it will be 1 for different binary bits; |
| 3. | The third bit for Gray code equals the exclusive-OR of the second and third bits of the binary number, and similarly all the next lower order bits follow the same mechanism. |

| 1. | The MSB of the binary number is the same as the MSB of the Gray code; |
| 2. | The second bit next to the MSB of the binary number equals the Ex-OR of the MSB of the binary number and second bit of the Gray code; it will be 0 if there are same binary bits or it will be 1 for different binary bits; |
| 3. | The third bit for the binary number equals the EX-OR of the second bit of the binary number and third bit of the Gray code, and similarly all the next lower order bits follow the same mechanism. |

| 1. | Many applications of digital computers require the handling not only of numbers, but also of other characters or symbols, such as the letters of the alphabet. |
| 2. | An alphanumeric character set is a set of elements that includes the 10 decimal digits, the 26 letters of the alphabet, and a number of special characters. |
| 3. | The standard binary code for the alphanumeric character is the American Standard Code for Information Interchange (ASCII), which uses seven bits to code 128 characters, as shown in Table 2.3. |
| 4. | The character is stored as one byte with one bit remaining unused. |
| 5. | The letter A, for example, is represented in ASCII as 1000001 (column 100, row 0001). |
