How to Design a Decimal to Binary Encoder

💡
Key learnings:
  • Decimal to Binary Encoder Definition: A decimal-to-binary encoder is a digital circuit that converts a decimal number into its binary equivalent.
  • Working Principle: The encoder has 10 input lines for decimal digits and 4 output lines for the binary code, converting one active input at a time.
  • Truth Table and Logic Expressions: The encoder’s truth table shows binary outputs for each decimal input, with logical expressions derived using Boolean algebra.
  • Applications: These encoders are used in keyboards, seven-segment displays, and binary adders to process and display numerical data.
  • Related Topics: Understanding encoders is linked to learning about decoders, multiplexers, demultiplexers, and the binary number system.

A decimal-to-binary encoder is a digital circuit that converts a decimal number into its binary equivalent. Also known as a decimal to BCD (binary-coded decimal) encoder, it represents each decimal digit with a 4-bit code. Digital systems use it for keyboard input, display output and binary arithmetic operations.

The sections below build the design step by step: encoder basics, the ten-input-to-four-output mapping and the decimal to binary conversion behind each output bit.

What is an Encoder?

An encoder is defined as a combinational logic circuit that converts a set of inputs into a unique output code. This output code shows the position or identity of the active input. An encoder typically has 2^n input lines and n output lines, where n is the number of bits in the output code. This means it can encode 2^n distinct inputs with n bits.

Encoders come in several types. Priority encoders assign a rank to each input and report the highest-priority active line when more than one is high. Simple binary-weighted encoders instead assume one active input at a time and OR the inputs that share each output bit.

How Does a Decimal to Binary Encoder Work?

A decimal-to-binary encoder usually consists of 10 input lines and 4 output lines. Each input line corresponds to a decimal digit from 0 to 9, and each output line corresponds to a bit in the BCD code.

digital encoder or binary encoder

The encoder accepts one active input at a time and produces the corresponding 4-bit BCD code at the output.

For example, if the input line D3 is active, meaning that the decimal digit 3 is entered, the encoder produces the BCD code 0011 at the output lines A3, A2, A1 and A0. Similarly, if the input line D7 is active, meaning that the decimal digit 7 is entered, the encoder produces the BCD code 0111 at the output.

The truth table for a decimal-to-binary encoder is shown below:

digital encoder or binary encoder truth table
InputsOutputs
D9 D8 D7 D6 D5 D4 D3 D2 D1 D0A3 A2 A1 A0
0 0 0 0 0 0 0 0 0 10 0 0 0
0 0 0 0 0 0 0 0 1 00 0 0 1
0 0 0 0 0 0 0 1 0 00 0 1 0
1 1 1 1 1 1 1 1 1 1 9 8 7 6 5 4 3 2 1 00000000000000000000

The logical expressions for the output lines follow from the truth table using Boolean algebra or Karnaugh maps. For instance, A3 is high only when D8 or D9 is high, so we write:

A3 = D8 + D9

Similarly, we can obtain the expressions for A2, A1 and A0:

A2 = D4 + D5 + D6 + D7

A1 = D2 + D3 + D6 + D7

A0 = D1 + D3 + D5 + D7

One qualification: because BCD represents the digit 9 as 1001, D9 also drives A0 in a complete design, so read the A0 expression above with that term added. With that noted, the logic circuit for a decimal-to-binary encoder can be built from OR gates as shown below:

decimal to binary encoder logic circuit

What are Some Applications of Decimal to Binary Encoders?

Digital systems use decimal-to-binary encoders wherever keypads, displays or arithmetic blocks meet BCD data. Some examples are:

  • Keyboard encoders: These convert keystrokes into binary codes a computer or calculator can process. A numeric keypad, for example, may use a decimal-to-binary encoder to turn pressed keys into BCD codes sent on to a calculator or an ATM.
  • Seven-segment display encoders: These convert BCD codes into the segment signals that drive a seven-segment display.
  • octal to binary encoder
  • A seven-segment display shows digits from 0 to 9 with seven LED segments arranged in a rectangular figure-8. Each segment switches on when a voltage is applied across it. Displaying a digit means switching the right pattern: the digit “5” lights segments A, F, G, C and D while B and E stay off. A seven-segment display encoder generates these signals from the BCD codes of the digits.
  • Binary adders: These add two binary numbers and can be constructed from AND, OR, XOR and NOT gates.
  • octal to binary encoder truth table
  • Adding two BCD numbers needs a special binary adder called a BCD adder. It carries between digit groups and corrects invalid BCD results with extra logic circuits.

What are Some Related Topics?

These encoders connect naturally to four related topics:

  • Binary number system: This system represents numbers with only two symbols, “0” and “1”, each called a bit (binary digit). Binary values convert to decimal (base-10), octal (base-8) or hexadecimal (base-16) using simple rules.
  • Decoder: This digital circuit performs the reverse operation of an encoder, converting an n-bit input code into one corresponding output. A BCD decoder, for example, turns an input BCD code into one of ten outputs representing digits “0” through “9”.
  • Multiplexer: This digital circuit selects one of several inputs and forwards it to the output under the direction of control signals, like a switch connecting one input through. An octal multiplexer picks one of eight inputs using three control signals.
  • Demultiplexer: This digital circuit distributes one input signal to several outputs under the direction of control signals, like an inverse switch. An octal demultiplexer routes its input to one of eight outputs using three control signals.

Conclusion

That covers the design of a decimal-to-binary encoder with logic gates and truth tables, along with its place in keyboards, displays and binary arithmetic.

Want To Learn Faster? 🎓
Get electrical articles delivered to your inbox every week.
No credit card required—it’s 100% free.

About Electrical4U

Electrical4U is dedicated to the teaching and sharing of all things related to electrical and electronics engineering.