Skip to content
UPEEC

BCD and Gray Code

Binary-coded decimal stores each decimal digit in 4 bits; Gray code changes only one bit between consecutive values.

Easy
Comments 0

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.

G=B⊕(B≫1)G = B \oplus (B \gg 1)

DecimalBinaryGray
0000000
1001001
2010011
3011010
4100110

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.