Question: Based on the figure below, implement two four bits adder using port - D as input for number A and number B , and port

Based on the figure below, implement two four bits adder
using port- D as input for number A and number B , and port-
A as output for result:
> Show the inputs and outputs interface with the ports.
> Develop the program to read the inputs, add the two
numbers then display the result on the lower four LEDs
of port A and LCD Line 1 Sum = xx.
> If the answer greater than 0 XOF , display the number as
before, in addition to set the Cout (port A bit 4) and on
Line 2 of the LCD display "Carry Flag Set""].
I am not able to upload an image but its a 4-bit adder
pls explain step by step i need the program like this:
#include
#include"config.h"
#include "LCD.h"
int main(void)
{
TRISA=0X0000;
TRISDbits.TRISD7=1;
TRISAbits.TRISA7=1;
TRISDbits.TRISD13=1;
TRISDbits.TRISD6=1;
int num1, num2, sum;
initLCD();
while(1)
{
homeLCD();
num1= PORTDbits.RD6*1+ PORTDbits.RD7*2;
num2= PORTAbits.RA7*1+ PORTDbits.RD13*2;
sum = num1+num2;
PORTA = sum;
14
setLCDC(LINE1);
putsLCD("Sum =");
putdLCD(sum);
setLCDC(LINE2);
if(sum>3)
{ PORTAbits.RA3=1;
putsLCD("Carry Set");
}
else
{PORTAbits.RA3=0;
putsLCD("");
}
}
return 0;
}(This is only an example of how i want it, this code is a 2-bit adder)
Based on the figure below, implement two four

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!