4 Bit Adder With LCD Monitor and Decimal Conversion

2.4K51

Intro: 4 Bit Adder With LCD Monitor and Decimal Conversion

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.

STEP 1: Placing Down the Materials Excluding the Wires

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.

STEP 2: 1st Half Adder

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.

STEP 3: Full Adders

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.

STEP 4: Testing With LEDs

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.

STEP 5: Connect the LCD Monitor

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.

STEP 6: 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.

STEP 7: Final Product


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

Comments

Love this project!!
Combining logic adders with binary to decimal conversion thru Arduino is great and useful:)