Contents

Digital Electronics
Number Systems
Logic Gates
Boolean Algebra
Combinational Circuits
Sequential Circuits
Memory & PLDs
Digital System Design
Other Topics
Other Subjects
Section Progress100%

23 of 23 articles

Code Converter Circuits

BCD to Gray, Gray to BCD, BCD to Excess-3 circuits.

Darshan N
Updated: 7 April 2026
9 min read

Microcontroller peripherals like the 8051 BCD output port and seven-segment display drivers depend on code converter circuits to translate between number representations. The 7447 BCD-to-seven-segment IC and the 74184 BCD-to-binary converter are two workhorses found in instrumentation front ends.

Common Code Converters in Digital SystemsBCD to Excess-3Add 0011 to BCD digitBCD 0101 → XS3 1000Uses: 4-bit adder 7483IC: 74LS83 (4-bit adder)Gray to BinaryBn = Gn XOR Bn+1MSB: B3 = G3Chain XOR downwardIC: 74HC86 (quad XOR)Binary to GrayGn = Bn XOR Bn+1MSB: G3 = B3Only one bit changes/stepIC: 74HC86 (quad XOR)Gray-to-Binary Conversion Table (4-bit)Gray (G3G2G1G0)Binary (B3B2B1B0)Decimal000000000000100011001100102001000113
Figure 1: Common code converter circuits and a partial Gray-to-binary conversion table

Core Concept

A code converter circuit translates digital words from one encoding scheme to another without changing the quantity they represent. The three most examined types are BCD-to-Excess-3, Binary-to-Gray, and Gray-to-Binary.

BCD-to-Excess-3 is implemented by adding 0011 (decimal 3) to each BCD digit using a 74LS83 4-bit binary adder. The 74LS83 has a propagation delay of 16 ns at 5 V. Excess-3 is a self-complementing code, meaning the 9s complement of a digit is obtained by inverting all bits.

Gray-to-Binary and Binary-to-Gray both use chains of XOR gates. The 74HC86 quad 2-input XOR IC is the standard choice. It operates from 2 V to 6 V, has a propagation delay of 7 ns at 5 V, and dissipates under 0.1 mW at static CMOS levels. Gray code is used in shaft encoders because only one bit changes between adjacent positions, eliminating glitching.

Boolean Expression

Binary-to-Gray conversion: G₃ = B₃, G₂ = B₃ ⊕ B₂, G₁ = B₂ ⊕ B₁, G₀ = B₁ ⊕ B₀. Each Gray bit is the XOR of the corresponding binary bit and the next higher binary bit. The MSB is unchanged.

Gray-to-Binary conversion: B₃ = G₃, B₂ = B₃ ⊕ G₂, B₁ = B₂ ⊕ G₁, B₀ = B₁ ⊕ G₀. Each binary bit is the XOR of the previously computed binary bit above and the current Gray bit. This chain is sequential from MSB to LSB.

Example
Given:
Binary number B3 B2 B1 B0 = 1 0 1 1
Convert to Gray code.

Formula / Rule:
G3 = B3
G2 = B3 XOR B2
G1 = B2 XOR B1
G0 = B1 XOR B0

Step by step:
G3 = 1
G2 = 1 XOR 0 = 1
G1 = 0 XOR 1 = 1
G0 = 1 XOR 1 = 0

Final Answer:
Gray code = 1 1 1 0

Verification (Gray back to Binary):
B3 = G3 = 1
B2 = B3 XOR G2 = 1 XOR 1 = 0
B1 = B2 XOR G1 = 0 XOR 1 = 1
B0 = B1 XOR G0 = 1 XOR 0 = 1
Binary = 1 0 1 1  Correct.
Exam Tip: In Gray-to-Binary conversion, the chain runs from MSB to LSB and each step uses the previously computed binary bit, not the Gray bit. A very common mistake is using G bits on both sides. For BCD-to-XS3, the carry out of the adder must be ignored — only the 4-bit sum matters. Anna University often asks you to design a 2-bit or 3-bit Gray converter using a K-map and XOR gates; memorise that the XOR gate is the only gate needed for both directions.

Key Properties

  • BCD-to-XS3: uses 74LS83 adder, propagation delay 16 ns, supply 5 V
  • Gray/Binary converters: use 74HC86 XOR, delay 7 ns, supply 2–6 V (CMOS)
  • 74HC86 power dissipation: less than 0.1 mW static, 80 µA max quiescent current
  • Fan-out: 74HC86 drives 50 CMOS or 10 TTL loads
  • Gray code: only 1 bit changes between consecutive values — eliminates encoder glitches
  • Excess-3 is self-complementing: inverting all bits gives the 9s complement
  • BCD-to-binary conversion for multi-digit BCD uses 74184 (dedicated IC, obsolete in new designs but exam-relevant)

Quick Revision

  • Binary-to-Gray: MSB unchanged, each lower bit = XOR of adjacent binary bits
  • Gray-to-Binary: MSB unchanged, each lower bit = XOR of previous binary and current Gray
  • BCD-to-XS3: add 0011 (binary 3) using a 4-bit adder
  • XS3-to-BCD: subtract 0011 (or add 1101) from XS3 digit
  • Gray code used in rotary encoders to prevent multiple simultaneous bit changes
  • 74HC86 quad XOR is the standard IC for Gray converters, 7 ns delay at 5 V
  • 74LS83 4-bit adder handles BCD-to-XS3, 16 ns delay
  • Exam trap: in Gray-to-Binary, students incorrectly XOR two Gray bits instead of the computed binary bit with the next Gray bit

Code Converter Quiz

Challenge yourself on BCD, Gray, and Excess-3 code conversion circuits.

Question 1 of 3

Q1.What is the Excess-3 code equivalent of BCD digit 6?