This project implements a 4-bit Full Adder using the ATmega16 microcontroller. It computes the sum and carry-out for two 4-bit binary inputs along with a carry-in signal. The results are displayed using LEDs connected to the microcontroller.
- 4-bit Binary Addition:
- Adds two 4-bit numbers (A and B) with a carry-in (Cin).
- Outputs the Sum and Carry-out (Cout) on LEDs.
- Dynamic Input Handling:
- Reads inputs directly from PORTA, PORTB, and PINB.
- Assembly Language Implementation:
- Efficient and optimized for microcontroller use.
- ATmega16 Microcontroller //1MHz internal clock used here
- LEDs (5) with 330 Ω resistors
- Push buttons (for binary inputs)
- Breadboard and jumper wires
- 5V Power Supply
- AVR Studio (for compiling the code)
- Proteus (for circuit simulation)
-
Assemble the Circuit:
- Connect inputs (A, B, and Cin) to PORTA, PORTB, and PINB, respectively.
- Connect outputs (Sum and Carry) to PORTC, where LEDs are attached.
- Use pull-down resistors with input buttons for stable signals.
-
Load the Assembly Code:
- Open
4bit_full_adder.asmin AVR Studio. - Compile the file to generate the
.hexfile.
- Open
-
Program the Microcontroller:
- Use a suitable programmer (e.g., USBasp) to flash the
.hexfile to the ATmega16.
- Use a suitable programmer (e.g., USBasp) to flash the
-
Run the Simulation:
- Simulate the circuit using Proteus to validate functionality.
- Test the hardware circuit with various input combinations.
-
Initialization:
- Input ports (PORTA and PORTB) are configured as inputs.
- Output port (PORTC) is configured to drive LEDs.
-
Input Handling:
- Binary values for A and B are read from PORTA and PORTB.
- Cin is derived from the 5th bit of PINB (via
SBRCandSBRSinstructions).
-
Calculation:
- A, B, and Cin are added using the
ADDinstruction. - Carry-out is detected using bitwise operations.
- A, B, and Cin are added using the
-
Output Display:
- Sum and Carry-out values are written to PORTC, lighting up the corresponding LEDs.
- Example: A = 6 , B = 4, Cin = 1 (in decimal) || Sum = 11, Cout = 0 (in decimal)
- ATmega16 Datasheet
- AVR Assembly Language Tutorial
- Proteus Circuit Simulation Tool //version 8.10 used in this project.



