- Asked 4/22
- 2078 Kartik · 3 marks
- 2078 Bhadra · 1.5 marks
- 2075 Chaitra · 2.5 marks
- 2068 Chaitra · 6 marks
Excess-3 code with examples
Short answer
Excess-3 code represents each decimal digit as 4-bit binary of (digit+3). Example: decimal 39 becomes 3→0110, 9→1100, so (0110 1100) in XS-3. It is self-complementing and aids decimal arithmetic.
Explain Excess-3 code with suitable examples.
Excess-3 (XS-3) code is a non-weighted BCD code in which each decimal digit is coded as the 4-bit binary of (digit + 3). It was used in early computers and calculators because it makes decimal arithmetic easier.
Excess-3 table
| Decimal | BCD (8421) | Excess-3 |
|---|---|---|
| 0 | 0000 | 0011 |
| 1 | 0001 | 0100 |
| 2 | 0010 | 0101 |
| 3 | 0011 | 0110 |
| 4 | 0100 | 0111 |
| 5 | 0101 | 1000 |
| 6 | 0110 | 1001 |
| 7 | 0111 | 1010 |
| 8 | 1000 | 1011 |
| 9 | 1001 | 1100 |
Codes 0000, 0001, 0010, 1101, 1110, 1111 are invalid (unused).
How to convert
Add 3 to each decimal digit separately, then write each result in 4-bit binary.
Example 1:
- 3 + 3 = 6 → 0110
- 9 + 3 = 12 → 1100
Example 2:
- 2 → 0101, 5 → 1000, 8 → 1011
Properties
- Unweighted code: bit positions have no fixed weights.
- Self-complementing: the 9's complement of a digit is obtained by simply inverting all bits. For example, 4 = 0111; inverting gives 1000 = 5 in XS-3, and . This made subtraction simple in old machines.
- No all-zero code: every valid code has at least one 1, which helps detect a dead line.
- Easy addition: when two XS-3 digits are added, a carry occurs exactly when the decimal sum exceeds 9. Correction: if there is a carry, add 0011 to the digit; if no carry, subtract 0011.
Addition example:
- , no carry
- subtract 0011: = 9 in XS-3
Excess-3 is therefore a convenient BCD code for decimal arithmetic, though it needs more bits than pure binary.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- ASCII code and binary-to-Excess-3 converter · Digital Logic, chapter 1 · asked 2×
- Excess-3 code and binary-to-Excess-3 converter · Digital Logic, chapter 1 · asked 2×
- 39 to Gray/Excess-3 and 2's complement addition · Digital Logic, chapter 1
- Digital/analog signals, Gray and Excess-3 codes · Digital Logic, chapter 1
- (1110)gray→BCD and (1430)₁₀→Excess-3 · Digital Logic, chapter 1