In my previous articles in this series, I talked about the different logic gates and how they can be used in computers. In this post, I am going to explain how computers perform addition on binary numbers using logic circuits. We will then proceed to make our own calculator on a breadboard with just logic gates.  ## Half Adders and Full Adders  (Source : https://www.tutorialspoint.com/digital_circuits/digital_arithmetic_circuits.htm) Adders are logic circuits which carry out the operation of addition on binary numbers. They are used a lot in the ALUs of computers and other processors. They also have other applications like finding addresses etc. In the last articles, while talking about addition of binary numbers, we noticed the relation between the basic addition rules and the output of the different gates like the XOR gate. Adders come in two varieties – the half adder and the full adder. The half adder is a simple circuit composed of two logic gates, a XOR gate and an AND gate. It adds two single binary digits and has two outputs, the sum and the carry. It is the most basic implementation of the addition rules mentioned in the last article. A full adder can add binary numbers and has three inputs, the two binary digits and also an input for the carry. A number of full adders can be used to add binary numbers of any number of digits. The full adder circuit can be implemented with two half adders and an OR gate. Two half adders are cascaded to form the full adder. The half adder has two inputs and two outputs. With a full adder, the sum output of the first half adder serves as one of the inputs for the second half adder. The second input for the second half adder is the carry digit from the previous sum, if there is any, and finally, the two carries are passed through an OR gate to combine them to form a single carry output. In the end, we end up with a single output and a carry bit. The explanation is pretty intuitive if you match it with the circuit diagram. ## Making our own full adder circuit I am going to show how we can build our full adder circuit to add binary numbers. In fact, I will use two full adders to add binary digits with up to two digits and we will display the results in binary format, with LEDs ## Components Required ### 1.Breadboard ### 2.XOR gates - HD74LS86P chips from Texas Instruments ### 3.AND gates - SN74LS08N chips from TI ### 4.OR gates - SN74LS32N chips from TI ### 5.DIP switches – preferably 2 x 4 DIP switches. ### 6.Wires to make the connections ### 7.LEDs for the output ### 8.Power Supply, a battery of around 5-9v ## Circuit Diagram  (Source - https://he-coep.vlabs.ac.in/Experiment1/Theory.html?domain=ElectronicsandCommunications&lab=Hybrid%20Electronics%20Lab ) ### In theory, n number of full adder circuits can be cascaded to add binary numbers with n digits. Here the circuit diagram shows four full adders which are cascaded. The inputs of each full adder are individual bits, A<sub>0</sub>, A<sub>1</sub>, A<sub>2</sub>, ... and B<sub>0</sub>, B<sub>1</sub>, B<sub>2</sub> and so on. A<sub>0</sub>, A<sub>1</sub>, A<sub>2</sub> etc are the digits of the first binary number and B<sub>0</sub>, B<sub>1</sub>, B<sub>2</sub> etc are the digits of the second binary number. They can be either 0 or 1 to form the number. (This is why we use a DIP switch, as it is easy to quickly set up numbers made up of 1s and 0s by flicking the switches up and down) The carry of the first (n-1) full adders goes to the carry input of the next gates respectively. ## Procedure We are going to wire up the circuit shown, step by step and by the end we will have a circuit where we can input two four digit binary numbers and we will get the sum as the output in the LEDs  First insert all the logic gates, XOR, AND and OR respectively. The number of chips needed will depend on the number of full adders you are planning to cascade. Each chip has four gates respectively.  Connect the VCC and GND of all the pins to power and ground.  I then connect the first five gates to from a single full adder circuit. Refer to the circuit often and have the datasheet of the chips you're using nearby too. Use wires of necessary length and this shouldn't be much of a challenge. ### (Here if you inspect closely, you can see that I got a wrong result even after wiring everything up. Later, I found out that it was because I had not connected the carry input of the adder to ground. This needs to be done, as the carry of the first full adder will always be 0)  I wired up two full adders, which can calculate the sums of all two bit numbers. It could add numbers from 0 to 3, and the maximum it could display was 3 + 3 = 6 The three LEDs are the two sums of the adders and the left most one is the carry of the last adder circuit. The DIP switches are used to input the binary numbers. When it is switched on, it represents a 1 and a 0 when its switched off. Here I have shown some examples.  # 0000 + 0001 = 001 ( 0 + 1 = 1 )  # 0001 + 0001 = 010 ( 1 + 1 = 2 )  # 0001 + 0011 = 100 ( 1 + 3 = 4 )  # 0011 + 0011 = 110 ( 3 + 3 = 6 )  # 0010 + 0011 = 101 ( 2 + 3 = 5 ) ## More Pics - Yay!  The connections from the DIP switches  The connections in the XOR gates  The connections in the AND gates  The OR gates and how we take the carry output. # Conclusion This is really fun project to do and you will learn a lot in digital electronics, like I did, while making this project. It is fairly simple and can be finished in half a day if you have all the components handy. It can also be improved upon a lot. You can add more full adders and increase the bits in the input number. You can further study about other operations such as binary subtraction and multiplication with logic gates and try to implement it also, although they would take up more space and will need more wiring. The Digital Electronics Series Part 1 : https://steemit.com/steemstem/@filler/digital-electronics-series-basics-of-logic-gates Part 2 : https://steemit.com/steemstem/@filler/digital-electronics-series-mathematical-operations-with-binary-numbers
author | filler |
---|---|
permlink | make-a-calculator-with-logic-gates-digital-electronics-series-part-3 |
category | steemmakers |
json_metadata | {"tags":["steemmakers","steemstem","science","electronics","diy"],"image":["https://cdn.steemitimages.com/DQmXVtyHx5p9r7GH3Ccy2TB38sDQ5MvnuDefJ5Qze11D1CA/P_20180714_192128.gif","https://cdn.steemitimages.com/DQmagfHMM4R7yLSBUJvnbHvqEcJFc1hs15BkcbUqwCvDY1X/full_adder.jpg","https://cdn.steemitimages.com/DQma94owkzw7CLnkVLE5JkiLYyL8G9zKZub7jmdgqSi3hdC/4-bit%20Adder.JPG","https://cdn.steemitimages.com/DQmc7GLHVK9NbpZPgz1hycpJogsmBwiiBdShd9HW11Ktqk8/P_20180714_144755.jpg","https://cdn.steemitimages.com/DQmReTLfVyu3WHptibUPiYxt5HFwvJHqroWH3oVikGoTvHB/P_20180714_150827.jpg","https://cdn.steemitimages.com/DQmePnYG58qK662JnkayY5WwGwSLGSBKFxrxzyn6bYdJCAP/P_20180714_163328.jpg","https://cdn.steemitimages.com/DQmfAFypRFq1JU7CtqE1oTsXny6SV4hAuzYmWpTjLcuiXh7/P_20180714_185909.jpg","https://cdn.steemitimages.com/DQmfJUix3yKt3gP8onwZrsfpgPZb8pZSF4r91Rda3XH3Ezs/example_1.jpg","https://cdn.steemitimages.com/DQmVpz1GVaENQVAivgjnnLgDx4weffbnqi1FfysJYU9ZSPd/example_2.jpg","https://cdn.steemitimages.com/DQmd3n7HGXPvNCKZCAwEKiEKpm1sJprGEpUAy39z5724XSj/example_3.jpg","https://cdn.steemitimages.com/DQmQADJWTw7ePvHfm7an53zMUM9fq6hErNt7xVGPWiqdkJU/example_4.jpg","https://cdn.steemitimages.com/DQmP5fefq5Xz6KzdPKQDbKSugc1kNkG9y9GxAPMAXVNfvns/example_5.jpg","https://cdn.steemitimages.com/DQmY3AK72Wm4JS1JUce53NZ1emVtMtJtCqPdynyRtePpgHt/P_20180714_192733_BF.jpg","https://cdn.steemitimages.com/DQmZtj1mMB7KrRaaY9yM2ivri4c6zbNJqPxSaEs4u4tirLD/P_20180714_192651_BF.jpg","https://cdn.steemitimages.com/DQmRPZtU4u9cErU6CD7ZK1Mv7TEaf33footyiJMtyqD1oQ4/P_20180714_192707_BF.jpg","https://cdn.steemitimages.com/DQmU5KezMLyHkrT64ShvPXNsJx8YdgD17rnNbsidS1cEV8U/P_20180714_192714_BF.jpg"],"links":["https://www.tutorialspoint.com/digital_circuits/digital_arithmetic_circuits.htm","https://he-coep.vlabs.ac.in/Experiment1/Theory.html?domain=ElectronicsandCommunications&lab=Hybrid%20Electronics%20Lab","https://steemit.com/steemstem/@filler/digital-electronics-series-basics-of-logic-gates","https://steemit.com/steemstem/@filler/digital-electronics-series-mathematical-operations-with-binary-numbers"],"app":"steemit/0.1","format":"markdown"} |
created | 2018-07-14 16:51:21 |
last_update | 2018-07-14 16:51:21 |
depth | 0 |
children | 5 |
last_payout | 2018-07-21 16:51:21 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.864 HBD |
curator_payout_value | 0.215 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 8,085 |
author_reputation | 4,924,532,976,740 |
root_title | "Make a calculator with logic gates - Digital Electronics Series Part 3" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 64,668,182 |
net_rshares | 477,308,929,473 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
deepam | 0 | 198,705,645 | 100% | ||
shaunmza | 0 | 16,740,302,173 | 90% | ||
pbock | 0 | 12,859,598,914 | 100% | ||
elviento | 0 | 649,051,221 | 3% | ||
thatsweeneyguy | 0 | 5,372,662,762 | 50% | ||
minnowsupport | 0 | 46,716,195,030 | 0.6% | ||
lengalenga | 0 | 558,401,317 | 100% | ||
jefpatat | 0 | 53,935,904,896 | 100% | ||
saimegh | 0 | 3,467,122,525 | 100% | ||
podanrj | 0 | 7,200,478,757 | 45% | ||
makerhacks | 0 | 86,849,073,028 | 50% | ||
sayee | 0 | 30,441,885,393 | 100% | ||
drmake | 0 | 109,170,346,479 | 100% | ||
dpalash124 | 0 | 2,987,651,331 | 100% | ||
steemmakers | 0 | 34,793,448,597 | 100% | ||
knfitaly | 0 | 6,505,904,467 | 35% | ||
salvadorcrg | 0 | 556,456,066 | 50% | ||
kaking | 0 | 265,329,963 | 50% | ||
marketstack | 0 | 9,453,115,005 | 1.49% | ||
robali123 | 0 | 1,786,060,751 | 50% | ||
ivan-g | 0 | 655,068,270 | 50% | ||
theguymasamato | 0 | 2,347,351,353 | 100% | ||
flash4yard | 0 | 1,745,679,080 | 100% | ||
rativiv | 0 | 9,180,067,465 | 25% | ||
dmxmaster | 0 | 590,714,134 | 100% | ||
thesteemhouse | 0 | 1,581,496,247 | 50% | ||
dick.sledge | 0 | 9,636,237,623 | 1.49% | ||
beetlevc | 0 | 6,787,010,168 | 25% | ||
electricswine | 0 | 1,571,295,350 | 50% | ||
electronicsworld | 0 | 6,582,805,706 | 100% | ||
filler | 0 | 1,232,949,418 | 100% | ||
sbi7 | 0 | 2,864,074,543 | 5% | ||
microoo | 0 | 585,165,814 | 50% | ||
negentropi | 0 | 1,441,319,982 | 100% |
Thank you for this post and previous posts in its series! It's important to educate people on the mysterious ways their precious laptops and smartphones work. The only thing I must add is .... ;-) 
author | beetlevc |
---|---|
permlink | re-filler-make-a-calculator-with-logic-gates-digital-electronics-series-part-3-20180714t185643073z |
category | steemmakers |
json_metadata | {"tags":["steemmakers"],"image":["https://cdn.steemitimages.com/DQmXEkFaBQjshNUFKvdwowpGZR83zsCb21f5afbUjZroRHr/clr.jpg"],"app":"steemit/0.1"} |
created | 2018-07-14 18:56:42 |
last_update | 2018-07-14 18:56:42 |
depth | 1 |
children | 1 |
last_payout | 2018-07-21 18:56:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 294 |
author_reputation | 545,461,774,582 |
root_title | "Make a calculator with logic gates - Digital Electronics Series Part 3" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 64,679,355 |
net_rshares | 1,214,455,176 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
filler | 0 | 1,214,455,176 | 100% |
author | filler |
---|---|
permlink | re-beetlevc-re-filler-make-a-calculator-with-logic-gates-digital-electronics-series-part-3-20180717t153259388z |
category | steemmakers |
json_metadata | {"tags":["steemmakers"],"app":"steemit/0.1"} |
created | 2018-07-17 15:33:00 |
last_update | 2018-07-17 15:33:00 |
depth | 2 |
children | 0 |
last_payout | 2018-07-24 15:33:00 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.037 HBD |
curator_payout_value | 0.011 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 64 |
author_reputation | 4,924,532,976,740 |
root_title | "Make a calculator with logic gates - Digital Electronics Series Part 3" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 65,005,260 |
net_rshares | 24,248,823,507 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
techtek | 0 | 24,248,823,507 | 50% | ||
sayee | 0 | 0 | 100% |
Very much complicated to learn but enjoyed the post.
author | dpalash124 |
---|---|
permlink | re-filler-make-a-calculator-with-logic-gates-digital-electronics-series-part-3-20180714t173650004z |
category | steemmakers |
json_metadata | {"tags":["steemmakers"],"app":"steemit/0.1"} |
created | 2018-07-14 17:36:51 |
last_update | 2018-07-14 17:36:51 |
depth | 1 |
children | 0 |
last_payout | 2018-07-21 17:36:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 52 |
author_reputation | 147,656,254,675 |
root_title | "Make a calculator with logic gates - Digital Electronics Series Part 3" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 64,672,420 |
net_rshares | 0 |
<p>Congratulations! This post has been upvoted from the communal account, @minnowsupport, by filler from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the <a href="https://discord.gg/HYj4yvw"> Peace, Abundance, and Liberty Network (PALnet) Discord Channel</a>. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.</p> <p>If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=minnowsupport&vesting_shares=102530.639667%20VESTS">50SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=minnowsupport&vesting_shares=205303.639667%20VESTS">100SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=minnowsupport&vesting_shares=514303.639667%20VESTS">250SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=minnowsupport&vesting_shares=1025303.639667%20VESTS">500SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=minnowsupport&vesting_shares=2053030.639667%20VESTS">1000SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=minnowsupport&vesting_shares=10253030.639667%20VESTS">5000SP</a>. <br><strong>Be sure to leave at least 50SP undelegated on your account.</strong></p>
author | minnowsupport |
---|---|
permlink | re-make-a-calculator-with-logic-gates-digital-electronics-series-part-3-20180716t084328z |
category | steemmakers |
json_metadata | "{"app": "beem/0.19.48"}" |
created | 2018-07-16 08:43:27 |
last_update | 2018-07-16 08:43:27 |
depth | 1 |
children | 0 |
last_payout | 2018-07-23 08:43:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,702 |
author_reputation | 148,902,805,319,183 |
root_title | "Make a calculator with logic gates - Digital Electronics Series Part 3" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 64,844,692 |
net_rshares | 0 |
<div class='pull-right'><center><a href='http://www.steemmakers.com'><img src='https://www.steemmakers.com/img/comment_logo_makers.png' /></a></center></div><b>Congratulations</b> This post has been upvoted by SteemMakers. We are a community-based project that aims to support makers and DIYers on the blockchain in every way possible. <br/><br/>Join our <a href='https://discord.gg/EFGbRuW'>Discord Channel</a> to connect with us and nominate your own or somebody else's posts in our review channel.<br/><br/><b>Help us to reward you for making it !</b> Join <a href='https://www.steemmakers.com/#/Trail'>our voting trail</a> or <a href='https://www.steemmakers.com/#/Delegation'>delegate steem power</a> to the community account. <br/><br/>Your post is also presented on the community website <a href='http://www.steemmakers.com'>www.steemmakers.com</a> where you can find other selected content. <br/><br/>If you like our work, please consider upvoting this comment to support the growth of our community. Thank you.
author | steemmakers |
---|---|
permlink | re-filler-make-a-calculator-with-logic-gates-digital-electronics-series-part-3-20180717t062453496z |
category | steemmakers |
json_metadata | "" |
created | 2018-07-17 06:24:51 |
last_update | 2018-07-17 06:24:51 |
depth | 1 |
children | 0 |
last_payout | 2018-07-24 06:24:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,019 |
author_reputation | 1,907,312,584,548 |
root_title | "Make a calculator with logic gates - Digital Electronics Series Part 3" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 64,955,359 |
net_rshares | 7,028,189,024 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
espoem | 0 | 5,838,392,836 | 5% | ||
filler | 0 | 1,189,796,188 | 100% |