Question: Write an assembly program to achieve the addition of two numbers entered to port B and display the result on port A . 1 .
Write an assembly program to achieve the addition of two numbers entered to port B and display the result on port AWe use the method of masking to separate the two numbers, since the first number is in the LSB of PORTB and the second number is in the MSB we separate the first number using the instruction ANDLW XF and the second number using the instruction ANDLW XF After that before we add the two numbers, the first number is ready for addition but the second number needs to be swapped, so we use the instruction SWAPF Fd to swap it swapping means F: F: F: F: After that we add the two numbers using the instruction ADDWF Fd and then we display the result on PORTA
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
