4 Bit Adder With LCD Monitor and Decimal Conversion

by DN - 652671 in Circuits > Arduino

2585 Views, 5 Favorites, 0 Comments

4 Bit Adder With LCD Monitor and Decimal Conversion

E4A67C6B-A9C9-47D8-9CDD-D849B037EE02.jpeg
Epic Turing-Bigery.png

This project computes the addition of up to 4 bits of 2 binary numbers. This means the max equation would be 1111+1111 which would equal to 11110. This project itself differs from a 2 bit adder. A 2 bit adder uses 1 half adder and a full adder, but a 4 bit adder uses 3 full adders and 1 half adder in the circuit. Each of the full adders have a carry value and a sum value, and the carry values contribute in the next full adder until the end when a carry value is left over as a 5th output. The twist on the 4 bit adder I chose to do is to display the output on an LCD monitor. Unlike the usual LED output, the LCD monitor would require the outputs directly connected to the Arduino as inputs for the LCD to output the answer in binary. The LCD monitor also is capable of displaying the binary numbers in decimal form which is also integrated into the code. Considering that 3 full adders would require 4+ AND and XOR gates, the supplies needed are as followed.

Supplies

x1 Arduino Uno

x1 Standard size breadboard

x4 Different coloured wires (1 colour for each adder section)

x2 Dip switches

x2 XOR Logic Gates

x2 AND Logic Gates

x1 OR Logic Gates

x1 LCD wire jumper (Phillips Serial Bus)

x1 LCD monitor

x8 10 kΩ Resistors (For the dip switches)

Placing Down the Materials Excluding the Wires

698E515C-5D3E-45CC-BE8F-55C5808C1615.jpeg

Firstly, we place down the materials onto the breadboard so everything is lined up ready to be wired up. In this picture, I connected the dip switches on the very left and the logic gates in proper order so wiring wouldn't be a problem afterwards. The order I've done for this circuit are as ordered from left to right, XOR, then AND, then 2ndf XOR, then 2nd AND, and then the OR gate. I also connected each component to power and to ground prior to the wiring afterwards.

1st Half Adder

E2F51060-BB20-4B76-A051-F338D75689F9.jpeg

The 2nd step is to create the half adder which gives the first sum and carry for the 1st full adder of the 3. The wiring for the half adder is simple. In this circuit, the 1st dip switch, 4th switch is connected to both XOR and AND gate, which goes for the 2nd dip switch 4th switch as well. The XOR output would be the first sum (s0) connecting to the Arduino Uno and the AND output becomes the carry for the full adder.

Full Adders

46EF9ED1-69FE-4A2C-ABD7-D889AA22F16D.jpeg
7DAA79DD-8DA7-473C-9775-ADA534FC029A.jpeg

This step applies for the next 3 full adders. These all cover for the next 4 outputs, s1, s2, s3, and c0. For the 1st full adder, it utilizes the carry from the half adder to be the carry input. The switches (1 to the left of the switches used for the half adder) are connected to both the XOR and AND just like the half adder. The special case with the full adder is that the carry of the previous adder is also included. In this case, the carry and the XOR output from the first XOR would go into another XOR gate. That would then become the sum for that adder, which in this case is s1. The first AND gate output would go to an OR gate. To complete the adder, another AND gate would be occupied by the carry from the previous adder and the output from the first XOR gate. This AND output goes to the OR gate which the output becomes the or for the next adder. These wiring instructions are the same for the next adder and also for the last adder. However, the last adder's carry would also become an output to the Arduino meaning there is 4 sums and 1 carry occupying the arduino in the end.

Testing With LEDs

3F4C7E43-3E08-428D-80A7-A8F5C77F8783.jpeg

Once the circuit is fully wired, I first tested the 4 bit adder with LEDs by connecting them onto a separate breadboard and bringing the inputs that go into the Arduino into the LEDs to test if the 4 bit adder calculates correctly. If the 4 bit adder displays the correct values, it would be safe to move onto the next step.

Connect the LCD Monitor

51A6D941-EA99-4A42-B5FE-E4E756DA377D.jpeg

Finally, the last physical circuit step is to connect the LCD monitor to the breadboard. This is connected directly with the wire jumper connecting 2 wires, the SDA (Serial Data Line) and the SCL (Serial Clock Line) to 2 analog pins on the Arduino. The other 2 wires would be one straight to power and to ground.

the Code

The next step is code itself which would power the LCD monitor portion of the circuit. The link to the code is below which includes the decimal conversions.

Final Product

4 bit Adder with LCD monitor final project

Finally after the code is uploaded with the circuit powered, the outcome would look like this.