# Display Binary Number on 7-segment Display

#### Python Person

Joined Feb 22, 2018
2
Hello all;

I am planning to create an adder circuit that will eventually (hopefully) be able to output a 5-bit binary number. I'd like to convert this binary number into decimal, then display the decimal number on a 7-segment display. Does anyone know of ICs or combinations of ICs that could accomplish this task? I would prefer not to use any microcontrollers or EEPROMs.

#### ericgibbs

Joined Jan 29, 2010
10,205
hi PP,
Welcome to AAC.

This PDF will get you started.
E

#### Attachments

• 88 KB Views: 66

#### MrChips

Joined Oct 2, 2009
21,343
74185 or 74LS185 for TTL version.

For 74HC185 CMOS version.

#### crutschow

Joined Mar 14, 2008
25,126
74185 or 74LS185 for TTL version.

For 74HC185 CMOS version.
I think those devices are obsolete but they are a simple solution if you can find them.

Converting binary to decimal is not simply done using logic only.
Here's a previous thread on that.
The simplest is probably the one using the combination of binary and BCD counters.
The binary counter counts the binary number down to zero while the BCD counter counts up for the same number of counts.
Thus at the end of the count, the BCD number is available at the BCD counter output.
Some added logic to control the counters along with a clock source is, of course, also needed.
The frequency of the clock determines how long the conversion process takes.

#### MrChips

Joined Oct 2, 2009
21,343
74185 found on ebay.

#### crutschow

Joined Mar 14, 2008
25,126

#### Python Person

Joined Feb 22, 2018
2
Alright, thanks so much for advice everybody!

I will look into the 74185 chips and the up/down counting - that seems interesting!

#### WBahn

Joined Mar 31, 2012
25,918
I think those devices are obsolete but they are a simple solution if you can find them.

Converting binary to decimal is not simply done using logic only.
Here's a previous thread on that.
The simplest is probably the one using the combination of binary and BCD counters.
The binary counter counts the binary number down to zero while the BCD counter counts up for the same number of counts.
Thus at the end of the count, the BCD number is available at the BCD counter output.
Some added logic to control the counters along with a clock source is, of course, also needed.
The frequency of the clock determines how long the conversion process takes.
And unfortunately this algorithm has exponential time complexity in the number of bits. Each additional bit in the binary value doubles the expected conversion time, which translates into each additional BCD digit increasing the conversion time by a factor of ten, making is a solution that doesn't scale beyond relatively small numbers.

#### dl324

Joined Mar 30, 2015
10,987
I will look into the 74185
A look up table in a byte wide EPROM/EEPROM would be more cost effective.

If you're not constrained for board space, you could design your own. The 4 bit binary to BCD converters in the circuit below are comprised of 20 gates:

#### crutschow

Joined Mar 14, 2008
25,126
And unfortunately this algorithm has exponential time complexity in the number of bits.
Not for anything I suggested.

#### WBahn

Joined Mar 31, 2012
25,918
Not for anything I suggested.
For exactly what you suggested.

Let's keep things easy and just look at numbers that need a 1 in the most significant BCD digit and 0's in all the others.

How many clock pulses are needed to convert the number for 2 BCD digits? 10.

How many clock pulses are needed to convert the number for 3 BCD digits? 100.

How many clock pulses are needed to convert the number for n BCD digits? 10^(n-1)

That's exponential growth in the number of digits (which is exactly the same as exponential growth in the number of bits, since the base in use has no effect on the time complexity family).

What is the expected conversion time for a randomly generated 64-bit binary number if the clock is running at 1 GHz? Just shy of three centuries. This is actually the median, not the expected, which is much closer to five centuries.

#### crutschow

Joined Mar 14, 2008
25,126
Okay, you got me (again).
But it's still a practical approach for many digital displays.
It can convert 7 digits (23 bits) in 1 second maximum using a 10MHz clock and logic.

64 bits is what, 20 digits? I haven't see many 20 digit displays.

#### crutschow

Joined Mar 14, 2008
25,126
Below is an LTspice functional simulation of the binary-to-BCD conversion counter technique for a maximum BCD value of 99 (7-bits). It can be readily expanded to with added counters.

The binary input is loaded in the U1 binary down counter at the start (11001 or 19d shown).
U1 then counts down while the BCD counters U2 and U3 count up.
When U1 reaches zero, the clock is stopped to both counters and the BCD counters now have the number in BCD.
This is shown as a 19d two digit BCD number in the plot, which can displayed with a BCD to 7-segment decoder.
Alternately the BCD counters can be replaced with the CD40110 decimal counter which has the 7-segment decoder built it.

Edit: Here's the updated schematic with a clock and logic to continuously perform the conversion.
To convert up to 99d requires 4 counters, 1 flip-flop, and 1 quad NAND gate.
The write-up on it can be found here.

Last edited:

#### WBahn

Joined Mar 31, 2012
25,918
Okay, you got me (again).
But it's still a practical approach for many digital displays.
It can convert 7 digits (23 bits) in 1 second maximum using a 10MHz clock and logic.

64 bits is what, 20 digits? I haven't see many 20 digit displays.
No, but consider that the National Debt Clock, which I believe updates every second, currently needs 14 digits and would require a 20 GHz counter. Of course, since it is a running total display, once it's set to the current value it only needs to count at the rate that the debt is increasing, which is "only" about 30 k$/s. #### dl324 Joined Mar 30, 2015 10,987 Does anyone know of ICs or combinations of ICs that could accomplish this task? Since you only need 5 bits, you could do it with around 30 gates vs the 40 that the more general cascadable solution I gave earlier would take. #### crutschow Joined Mar 14, 2008 25,126 I updated the counter circuit in post #13 to include a clock oscillator and all logic. #### MrChips Joined Oct 2, 2009 21,343 Since you only need 5 bits, you could do it with around 30 gates vs the 40 that the more general cascadable solution I gave earlier would take. Single chip solutions are available. 74185 or 74LS185 binary-to-BCD converter is simply a 32 x 8-bit PROM (7488) Any byte-wide memory chip will do the trick. Or even a simple Microchip PIC or MSP430G2553 MCU will do the job. #### dl324 Joined Mar 30, 2015 10,987 74185 or 74LS185 binary-to-BCD converter is simply a 32 x 8-bit PROM (7488) Those chips are virtually unobtainium. I didn't look closely at the packages of the parts referenced on eBay (to see if there were indications of them being counterfeit), but at$6 each, that's an expensive solution.
Any byte-wide memory chip will do the trick. Or even a simple Microchip PIC or MSP430G2553 MCU will do the job.
The OP's requirements were:
Does anyone know of ICs or combinations of ICs that could accomplish this task? I would prefer not to use any microcontrollers or EEPROMs.

Last edited: