Binary Coded Decimal (BCD)
Overview
Binary Coded Decimal (BCD) is a method of encoding decimal numbers where each decimal digit is represented by its own 4-bit binary code. While BCD uses more bits than pure binary, it simplifies conversion to and from decimal and is widely used in digital systems where decimal display is important, such as calculators and digital meters.
Detailed Explanation
Basic Encoding
Decimal | BCD | Binary
--------|--------|--------
0 | 0000 | 0000
1 | 0001 | 0001
2 | 0010 | 0010
3 | 0011 | 0011
4 | 0100 | 0100
5 | 0101 | 0101
6 | 0110 | 0110
7 | 0111 | 0111
8 | 1000 | 1000
9 | 1001 | 1001
10 | 0001 0000 | 1010
Characteristics
1. Each decimal digit: 4 bits
2. Valid codes: 0000 to 1001
3. Invalid codes: 1010 to 1111
4. Storage efficiency: ~17% overhead
(e.g., 0-99 needs 8 bits in BCD vs 7 in binary)
BCD Addition
Step 1: Add normally
Step 2: If sum > 9, add 6 (0110)
Example:
5 (0101)
+ 4 (0100)
-------
9 (1001) OK
8 (1000)
+ 4 (0100)
-------
12 (1100) Invalid!
+ (0110) Correction
-------
18 (0001 1000) Final BCD
Applications
1. Digital Displays
7-segment displays
LCD readouts
2. Financial Systems
Exact decimal representation
No rounding errors
3. Data Entry Systems
Keypad inputs
User interfaces
Practice Problems
-
Convert to BCD:
- 28
- 395
- 1000
-
Perform BCD addition:
- 45 + 38
- 67 + 86
- 93 + 8
References
- Digital Design Principles by Wakerly
- Digital Electronics by Floyd
- BCD Tutorial