# Binary adder with 7-seg display

Discussion in 'The Projects Forum' started by pillyg, Sep 19, 2011.

1. ### pillyg Thread Starter Member

Sep 19, 2011
52
0
Hi, I am new to electronics an this is my first project. I want to make a 6 or 8 (probably 6) bit binary adder/subtracter. I want the final answer to be displayed on a 7-seg display. I also want the 2 numbers being added to be displayed on a 7-segment display. There would be 3 total displays the answer and the 2 numbers being added. I have done some research and found projects that are only 4 bit. The ones with 7-segment displays are only one digit. How would I do this? I would be making this with logic ICs (like quad 2 input AND gate). I would also be using decoders/drivers for the displays

Thanks,
William.

2. ### Robin Mitchell Well-Known Member

Oct 25, 2009
732
199
Use two 4 bit 4008 adder chips. Take the carry out of the first one into the carry in of the second one. Ignore the high few bits of the second out put depending on the bit size of the calculator.

Only problem is this circuit will be complex for beginners. To display the numbers being added, then to show the result, your going to need a micro controller, like a PIC. And if you use one, hell, you can make it do multiplication, division etc

3. ### pillyg Thread Starter Member

Sep 19, 2011
52
0
I am going to have 3 separate displays. 2 for the numbers being added, and 1 for the final result. Each display will have a specific thing to show. I am going to use 2 4 bit adders (7483). Since I can just connect 2 of then (carry out to carry in) to make an 8 bit adder that answers 1 of my questions.

My 2nd question is how can I hook up 2 or 3 single digit 7-seg drivers to drive 3 displays? (displaying a 3 digit 8 bit number) Do I need a full 3 digit display or can I use 3 1 digit displays?

finally, what is the difference between:

http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_50631_-1

and

http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_48063_-1

4. ### elec_mech Senior Member

Nov 12, 2008
1,513
193
LS chips consume more current than non-LS chips at a glance. I'm sure someone here can provide more info on the differences, but as far as I can tell, the LS consumes a max of 1mA whereas the other one consumes 0.1-0.2mA max. If you are going to make this battery-powered, then go with the non-LS version. Of course, if you're going to use 7-segment displays, batteries won't last long anyways, so I'd go with the cheaper one.

If you can post a schematic once you get the adders to do want you want, I'll do my best to help you add 7-segment displays so you can view the input and output. Looks like you'll need a binary-to-BCD converter or binary-to-7-segment converter of some type. I can look into this, but I need to see your circuit first.

5. ### pillyg Thread Starter Member

Sep 19, 2011
52
0
Sorry if this looks bad but this is all I could do. If you have any questions about it just ask. Note that the wires coming out of the operand 7-seg displays are operands that were split off before the display. They never touch any display stuff. They go straight to the adder ICs. The input operands are split into 2 lines. 1 to the display drivers and 1 to the adders.

File size:
162.7 KB
Views:
294
6. ### elec_mech Senior Member

Nov 12, 2008
1,513
193
William,

This is certainly an interesting challenge. Before I confound myself more, how are you planning to set the input operands exactly?

Also, is just an adder okay? I'm not quickly finding a subtractor IC.

7. ### pillyg Thread Starter Member

Sep 19, 2011
52
0
I am going to use DIP switches to set the inputs. Id like subtraction but that would be too difficult so just an adder is ok.

For the displays, do I need a 3 digit display or can I use 3-1 digit displays?

8. ### elec_mech Senior Member

Nov 12, 2008
1,513
193
Hi William,

Okay, this is more complicated than I originally thought. The problem is displaying numbers greater than 9. A single digit display can only show 0-9. So, you add more digits, but you must tell each digit what to display, 0-9. Since each digit functions independently from one another, the largest binary value you can display is 9. This isn't a problem for clocks and counters because there are chips to cascade multiple digits. However, in your case, you need to be able to take an 8-bit binary number (up to 255) and convert it into a BCD value for each place: ones, tens, & hundreds. BCD stands for binary-coded decimal which is how data is typically sent to 7-seg. driver chips.

You may be able to use logic ICs to decode an 8-bit binary value into three separate BCD ones, but it will probably take a lot of time to design and space on a board.

You could cheat a little by adding each value one at a time. In other words, adding the ones place which would be a 4-bit binary value (0-9), then the tens, then the hundreds - one 4008 per digit. I'm not sure how you would carry a one to the next value in the case of 10 or more. Also, unless you added some logic, it wouldn't be limited to 255 but rather to 999.

9. ### SgtWookie Expert

Jul 17, 2007
22,182
1,728
You could compromise and display it in octal rather than hex. You would need more displays/drivers but it's very easy to do.

10. ### pillyg Thread Starter Member

Sep 19, 2011
52
0
Hum. That's not good. I defiantly want it to be displayed in 0 to 9 though with the actual decimal answer.

I just found this thread, I think this is just about exactly what I want to do

Can you please explain the first response. I think I know what it is saying but Im not sure. What parts would I need for that?

11. ### pillyg Thread Starter Member

Sep 19, 2011
52
0
I want to do this by counting down a binary counter while counting up a BCD counter. How would I do this?

This will explain more

Another way to do a Binary-to-BCD conversion is to use a binary up/down counter and a BCD counter. The binary number is parallel jammed into the up/down counter. Then the counter is clocked to count down to zero. The same clock is used to clock the BCD counter up from zero. When the binary counter reaches zero, the BCD counter will contain the binary number in BCD format.

from http://www.electro-tech-online.com/general-electronics-chat/95009-8-bit-binry-decimal-circuit.html

thanks,
William

12. ### crutschow Expert

Mar 14, 2008
12,981
3,221
To minimize part count you can use the CD40110 decade counter which has a built-in 7-segment LED decoder, thus you only need one chip per LED digit.

13. ### pillyg Thread Starter Member

Sep 19, 2011
52
0
Is that a binary or a BCD counter? It doesn't have any jam bits so I will still need another counter.

If it isn't too much work can someone make a schematic for me? This is my first project and Im not quiet sure what to do.

William

14. ### elec_mech Senior Member

Nov 12, 2008
1,513
193
William,

Hmm, this is intriguing. A quick sketch on paper reveals this might work. I assume you're still trying to create a display for an 8-bit adder?

If you allow the user to increment the first number and second number (the two being added) one-by-one using a switch, you could use a simple BCD counter chip such as a 4510/4511 combo. The user presses the button for the first number, the display is incremented by one and so on until the first desired value is reached, then repeat for the second value. Obviously, at 8-bits, you could need to press the button up to 255 times which is tiresome. I can show you how to add an auto-counter that allows the user to hold the button down and have the value increment continuously until the user releases the button using a 555. If you have another idea on how the user enters the input values, let me know.

Okay, so the user has pressed two buttons to display the desired values of the two inputs to be added. The BCD value of each digit (output of the 4510) is then fed to a presettable BCD down counter (or a BCD to clock generator if such a thing exists). Assuming the former, another 4510 will work and the user presses another button that presets the two values into the down counter AND resets a binary counter, such as a CD4020 or CD4040, to zero. The counter then counts down to zero and stops. The clock pulses are fed to the binary counter until they stop when the down counter reaches zero.

Now the binary value (for each input value) is fed into your adder circuit which spits out a binary number. This number is fed to a binary count down circuit (perhaps a CD4516), using a similar system as mentioned above to convert the new binary value into a BCD value which is then put on a display. This assumes we can find a suitable (large enough) binary count down IC or can cascade them in order to do so.

This would be a fairly large circuit with lots of ICs. I'm game if you are, but I leave it to you to design the bulk of the circuit as this is your project.

15. ### crutschow Expert

Mar 14, 2008
12,981
3,221
The 40110 is a decimal (BCD) counter. You also need a binary counter, which is where the bits from the adder are jammed.

You will also need a clock, such as a 555 astable, and some logic to control the count and display functions.

Edit: This brings up an additional point. If you enter the values with dip switches I assume those would be decimal. If the number is larger than 9, then you would need to convert those to binary for the addition, and then back to BCD after the addition.

I think elec mech thoughts on how to do this are good. If you enter the numbers sequentially with a push button, then you can go directly to the BCD counter and use that to both display the input number with one counter and do the addition with another counter. You should be able to OR the pulses from each input into a third counter to perform the addition unless the inputs are occurring simultaneously.

Otherwise I think it's getting too complicated for anything but a microprocessor to perform.

Last edited: Oct 7, 2011
16. ### elec_mech Senior Member

Nov 12, 2008
1,513
193
I just saw your last post. I can draw you a simple block diagram of the ICs involved to get you started if you'd like, but you'll need to look at the data sheets and research some circuits made with them so you can begin drawing your schematic.

This is will require several ICs and a large schematic, plus you'll need to figure out if it is possible to convert an 8-bit binary number into a BCD value - I just don't know if there is a way to preset an 8-bit binary value into a count down counter.

This might be a bit much for a first-time electronics project. Not to discourage you in the least, but the schematic alone will be a lot of work, even for a seasoned professional (not I), which is why I leave it to you to do the schematic. It also helps you learn by doing. This hasn't been done by many, if any, otherwise you probably would have found a schematic for it or something close to it by now.

17. ### pillyg Thread Starter Member

Sep 19, 2011
52
0
OK. I have changed my plans a bit to make this easier. I will use the push button way of entering the values and I would like to be able to have it auto count when you push the button. Also, would I be able to do this in 6-bit or would that not work? Do I need multiples of 4? I will have 2 displays for each input, and 3 for the output. Is there a good free schematic program that will work for this?

I will start by getting the 6 bit inputs to be displayed on the 2 7-seg displays by push button.

18. ### elec_mech Senior Member

Nov 12, 2008
1,513
193
Here we go, reading your last post got me thinking. If we have the user start by setting the input values to zero, you can use a pair of 40110s to display the two-digit values of each input and a pair of 4516s to count out the binary value real time instead of going through a count down circuit. We share the clocks and reset pins of the 40110s and 4516s. When the user presses reset, the display and binary count go to zero. When the user presses a button to increment the count, the display and the binary value increase by one. It looks like we can cascade the 4516s as well, so getting 6- or 8-bits shouldn't be a problem. Dropping down to 6-bits decreases the parts count considerably since the digits displayed goes from 3 to 2.

19. ### elec_mech Senior Member

Nov 12, 2008
1,513
193
As far as programs, I like to draw out my circuits in Visio, but it ain't cheap. Bill uses MS Paint which is free and likely on your computer if you're using Windows. You'll need to create your own templates (drawings) of the ICs, resistors, etc., but it isn't hard and won't take too long. Once drawn, you save them and reuse for other circuits. If you ask nicely, Bill might share his with you . . . Obviously, you have to draw all the connections or routes. I like Visio for this because it has a connector tool to do so.

There are countless opinions on the best software for schematic capture and PCB design, both free and paid for. You can use a schematic capture if you prefer, there are pros and cons to it. If you're planning to design circuits professionally down the road, search the forum for schematic capture software and PCB software. If not, give ExpressPCB a shot. I haven't used their schematic capture, but I tried their PCB layout software the other week and it took almost no time to learn.

If you're planning to make multiple PCBs, you definitely want to search the forum first for the best software. ExpressPCB is free, but if you decide to send out to have a PCB made, you have to use them, at least for your first few boards. After that I've read here they'll give you the necessary files to give to our manufacturers who can make it cheaper. If you're not going to send out for boards, then go ahead and give the software a try, it is free after all.

20. ### pillyg Thread Starter Member

Sep 19, 2011
52
0
That sounds good. Everything you are saying is kind of confusing to me but I think I understand. When the user pushes a button to increase the A input value, it adds 1 to the 7 segment and 1 to the binary. That binary number goes to the adder when the user is done selecting what value they want. (I will use a toggle switch to send the inputs to the adder) Can I connect 2 40110s together to drive 2 displays of a 6 bit number? (that's cascading right?)

I think this means we are done with step 1 or getting the inputs to be displayed. The user pushes a button which adds 1 to a binary counter and a 40110 connected to 2 7-seg displays. They keep pressing until the number they want is showing Then when the user has selected his/her number, they will send the binary output of the binary counter to the 2 4-bit adders connected together which will start step 2.

Is everything correct?

William.

Last edited: Oct 7, 2011