# How to convert 9 bit binary to BCD for 3 Seven Segment Displays

I have been learning logic gates and binary so I made an 8-bit addition and subtraction calculator. When I add or subtract, the output is 9 LED's in regular binary. I have researched ways to convert Binary into BCD to be displayed to a seven segment display using a 7447 IC. I have checked other posts on Stack exchange which I found one but it didn't really answer my question. So the question is: Is there a simple way or Ic chip that I can use to convert 9 bits into BCD without worrying about the negative numbers? I do not want to use a microcontroller so I can do everything without programming. I have also heard something about using ROM which I don't know how to use or code with Assembly but I am still interested in that. I am not experienced at all with those sort of things. Any suggestions would be very most welcome.

• @jsotola sorry I meant without programming unless a programmable ROM is a way to go. I just don't want to use a microcontroller. – Andrew Mar 25 '18 at 3:20
• I mean, you could program and make your own computer... something like this... though this is rather extreme (but it's still my favorite video on YouTube). You need some type of signal where you toggle HIGH and LOW for nine different inputs. I recommend a few demultiplexers for this project. – KingDuken Mar 25 '18 at 3:45
• you could use a rom like you mentioned ... it would have to be 512 words of 12 bits each ... the 12 bits would be the 3 x 4bits .... you would still need a bcd to 7-segment decoder for each digit .... you could also use 3 of 512byte x 8bit roms, which would output the 7-segment values directly – jsotola Mar 25 '18 at 4:21
• The thing you have to realize about this kind of question is that it is highly artificial. There's no real circumstance where you would need to do this. Anything meant to display to a human can use software; dedicated logic only gets used when something needs to be fast or parallel far beyond human scale, which doesn't apply to a display. The reason little elegantly fits for implementing this type of solution, is that this type of solution doesn't make any sense for your problem. If you want to do it as an academic exercise, put in a corner of an FPGA or in a CPLD; otherwise use an MCU. – Chris Stratton Mar 25 '18 at 5:08

The modern technique would be to use a microcontroller to perform the conversion. Of course, you'd need one with (nominally) 20 bits of IO - 9 in and 11 out. (hint - what is the maximum value of 9 bits binary). You can get away with fewer IO lines if you add external circuitry: multiplexers on the input and latches on the output.

The old-school way is to use dedicated ICs, specifically the 74185. Of course, you'll need 6 of them, they're no longer made (although you can find them on eBay) and they need a lot of power, but it's doable.

The intermediate technique is to use a couple of PROMs. A couple of 2716s will do you, but you'll have to do your own programming. They're cheap enough although they take up some board space. This is the approach I'd use, but you can make your own choice.

I would say just do the maths in BCD in the first place, but anyway...

Back before micros were the solution to everything, I had two similar problems.

One used two separate counters one binary (tuned the radio synthesiser) and one bcd (displayed the frequency). They counted up/down together, so no conversion was ever required.

The other had a bcd counter/adder/alu with a display, that had to be punched to paper tape as binary. The conversion was done destructively, by clocking the bcd down and binary counter up, until the bcd counter underflowed (up/down counters). This only required a couple of cmos IC's. [why? I think binary = less paper tape = fewer after hours / weekend trips out to change the tape]

BTW this technique remains a compact way to do binary->bcd on some micros, if a little slow.

A slight variation on the ROM method will almost halve the hardware. Since it is for display, you can multiplex the display without latches and let the user's eye provide the storage.

For example, use an x8 Parallel EEPROM with at least 10 address inputs and feed a clock to the 10th. Connect the 8 data outputs to two 7447s and to three displays. The anodes of the least significant pair get driven by the clock and the anode of the MS digit by the inverted clock (add a bit of dead time if ghosting is an issue).

Write a little program in your favorite programming language to spit out a binary or Intel hex file for your EEPROM programmer.

You could also multiplex the outputs with a 2 bit counter and 1 of 4 decoder, replace the 7447 with transistors and convert 11 bits with a single 8Kx8, or retain the two 7447s and biplexing and convert 12 bits to 4 digits (0..4095).

You will notice that the parts for most of these schemes are obsolete or soon to be.. nobody does wasteful things like this in any quantity, even for very old existing designs, so the market has long since dried up. A micro and/or an FPGA is generally the answer.