# Foundation of Computers part 3: Full adder

In this article we’ll look at adding together larger binary numbers, and learn how you can apply the process to add numbers of any size.

In a previous article we looked at using the logic gates in integrated circuits to add binary numbers. We can think of the half-adder that we created as being like a jigsaw piece.

You can attach the two bits that you want to add at the top. The outputs are a sum bit and a carry bit.

We can use the half-adder to add two bits together, but we cannot reuse it to do anything else. The problem is shown in the diagram below. A half-adder can generate a carry bit, but since it cannot take one, we cannot chain them together.

What we need is jigsaw piece that can accept a carry bit, as well as producing one. This is called a full-adder:

With a full-adder we can add binary numbers of any size by simply chaining enough pieces together:

## Creating a full-adder

Hopefully that metaphor made some sense to you, but if not, just know that the truth table for what we need is as follows:

Carry in | A | B | Carry out | Sum |
---|---|---|---|---|

0 | 0 | 0 | 0 | 0 |

1 | 0 | 0 | 0 | 1 |

0 | 1 | 0 | 0 | 1 |

0 | 0 | 1 | 0 | 1 |

1 | 1 | 0 | 1 | 0 |

0 | 1 | 1 | 1 | 0 |

1 | 0 | 1 | 1 | 0 |

1 | 1 | 1 | 1 | 1 |

We can still use AND and XOR logic gates to achieve this:

Because the integrated circuits that we used in the previous article each contain four logic gates, we have more than enough to build a full-adder. You might have noticed that there is no OR gate in the circuit below. I simply connected the output from both AND gates to the LED. The consequence is that if there is an output from both AND gates, the LED will receive double the voltage.

Shown below is a video of the circuit in action. You’ll notice that the DIP switch block is off to the side on a separate mini-breadboard. It stopped holding in place on the main breadboard so I had to move it. The overall design of the circuit is the same.

## Using a full-adder integrated circuit

As you may have guessed, there is an integrated circuit that combines all of this functionality together. The following diagram shows the purpose of the pins on a CD74HC283 4-bit binary adder. This integrated circuit contains four full adders chained together, which means that you can add two 4-bit binary numbers.

The VCC and GND pins should be familiar from previous articles. These are the pins that you use to supply power to the IC. The CIN and COUT pins are also easy to explain. These are for the carry-in and carry-out bits. A carry-in for the first full-adder in the chain, and a carry-out for the last full-adder in the chain.

The remaining pins are in four groups, numbered 0, 1, 2, and 3. Each group of pins is for a full-adder in the chain. A and B are the inputs, and S is the sum. The carry bits are handled internally. Going back to the jigsaw metaphor, the inputs and outputs are represented in the following diagram:

To start we’ll use a single full-adder in the chip. This is the first jigsaw piece on the right. We’ll add in bits through the CIN, A0, and B0 pins. We’ll take outputs from the S0 and S1 pins. Because we aren’t adding any bits through the A1 or B1 pins, the S1 will be the carry-out from the first full-adder.

The result is a circuit that is a lot simpler than the full-adder that we created before:

The following video shows the circuit in use:

## Adding four bits

It is quite simple to convert the previous circuit to one that adds two sets of 4-bits. We need eight switches for the inputs, and five LEDs for the outputs. The breadboard would get a little crowded, so I created a wooden stand to hold everything in place.

It may look complicated, but the connections are simple. A switch is connected between Vcc and each input. An LED is connected between each output and ground. Just like the previous circuit, a pull down resistor is connected to each input, and there is a resistor in series with each LED to reduce the voltage. The following breadboard diagram shows a single switch connection and a single LED connection as examples:

The result is a binary calculator, as demonstrated in the following video: