BCD and Gray Code
Binary-coded decimal stores each decimal digit in 4 bits; Gray code changes only one bit between consecutive values.
Easy
BCD: 59 → 0101 1001. Used by real-time-clock chips and 7-segment displays.
Gray code: consecutive values differ by exactly one bit, so a reading taken mid-transition is never wildly wrong — used in rotary encoders and to pass counters between clock domains.
| Decimal | Binary | Gray |
|---|---|---|
| 0 | 000 | 000 |
| 1 | 001 | 001 |
| 2 | 010 | 011 |
| 3 | 011 | 010 |
| 4 | 100 | 110 |
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.