4 Bit Adder With Decimal/Base 10 Seven Segment Display
by ErtanR in Circuits > Arduino
120 Views, 1 Favorites, 0 Comments
4 Bit Adder With Decimal/Base 10 Seven Segment Display
This instructable demonstrates how to build a 4-bit adder and display its output as a decimal number using two seven-segment displays and two 7447 BCD-to-seven-segment decoder ICs.
Supplies
1x Arduino Microcontroller
2x Breadboard
Colored Jumper Wires (Black, Red, Yellow, Green)
2x XOR Gates
2x AND Gates
1x OR Gate
2x 7447 Decoder Chips
2x Dip Switches
8x 10kΩ Resistors
4x 330Ω Resistors
Note: To test the 4-bit adder before building the output assembly, you need
5x LEDs
5x 330Ω Resistors
Inspiration
As I began researching ideas for my final project, I came across an Instructable that demonstrated how to build a 4-bit adder with its output displayed on seven-segment displays using CD4511 decoder chips.
I decided to recreate the project to gain a deeper understanding of how a 4-bit adder functions and how its binary output can be displayed as a decimal number. While my design follows the same overall concept as the original project, I made several modifications to improve its simplicity and efficiency. I streamlined the code, removed unnecessary complexity, and focused on creating a cleaner and more organized circuit layout.
Building the 4-Bit Adder
Before wiring the circuit, it is recommended to carefully plan the layout. Breadboard space can become limited quickly, and a planned design makes troubleshooting significantly easier.
Build the circuit one full adder at a time and verify its operation before moving on to the next stage. This approach helps isolate wiring errors and simplifies debugging.
Using the circuit diagram as a reference, connect the carry-out of each full adder to the carry-in of the next stage. This creates the ripple carry effect necessary for multi-bit addition.
Particular attention should be paid to the DIP switch inputs. Each switch should use appropriate pull-down resistors to prevent floating inputs and ensure every input consistently reads either a logic HIGH or logic LOW.
The completed adder will produce five output bits:
- S0 (Least Significant Bit)
- S1
- S2
- S3
- C4 (Final Carry-Out)
These outputs represent a binary value ranging from 0 to 30. When complete, ensure the LEDs match the corresponding truth table. Once you're 100% sure that your 4-bit adder works, remove the LEDs! Not needed anymore.
Building the Output Assembly
The output system converts the binary result of the adder into a decimal value displayed on two seven-segment displays.
The five outputs from the 4-bit adder are connected to Arduino input pins (A0-A4). The Arduino reads these bits and combines them into a single decimal value.
Since a 4-bit adder can produce values from 0 to 30, two seven-segment displays are required:
- One display shows the tens digit (0–3)
- One display shows the units digit (0–9)
The Arduino separates the decimal result into tens and units digits. Each digit is then converted into Binary Coded Decimal (BCD) format and sent to a dedicated 7447 decoder IC.
Each 7447 decoder receives four BCD input bits and automatically drives a common-anode seven-segment display to show the corresponding decimal digit.
Once this output assembly is made, combine both breadboards with the arduino! I used pins A0-A4 for the 4-bit adder outputs, 3-6 for the first decoder, and 8-11 for the second decoder!
Code
The Arduino continuously reads the five output bits from the ripple carry adder.
The bits are combined into a single decimal value using binary place values. The result is then separated into tens and units digits.
The units digit is sent to the first 7447 decoder, while the tens digit is sent to the second decoder. Each digit is transmitted as a 4-bit BCD value.
The 7447 decoders convert the BCD signals into the appropriate segment outputs, causing the seven-segment displays to show the decimal equivalent of the binary sum.
As a result, whenever the inputs to the adder change, the displayed decimal value updates automatically.
A copy of the code is attached for you to download!