Multiplication and Division
Multiplication and Division
Aim:
To write an assembly language program for multiplication and division of two 8 bit
numbers in PIC16F877 microcontroller and verify the same using Microchip IDE simulation.
Apparatus Required:
Procedure:
Algorithm:
1. Multiplication:
1. Start the program
2. Initialize the Input and Output registers.
3. Clear the W register.
4. Add the multiplicand with the W-Register.
5. Decrement the multiplier by 1 and check for zero if not zero continue adding the
multiplicand with W register if zero stop adding.
6. Store the W register value in product High.
7. Check the carry flag: if set increment product low.
8. Stop the process.
2. Division:
1. Start the program
2. Initialize the Input and Output registers.
3. Clear the W register.
4. Load the divider to the W-Register.
5. Subtract the divider from the dividend value.
6. Increment the quotient value by 1.
7. Store the dividend to get remainder.
8. Check the carry flag : if it is 0continue subtracting the value of W reg from
dividend.
9. If the carry flag is 1 then terminate the subtraction loop.
10. Stop the process.
4
PROGRAM:
1. Multiplication:
5
2. Division:
6
SAMPLE INPUT AND OUTPUT:
1. Multiplication:
ADDRESS DATA
DATA1 (70)
DATA2 (71)
PRO_L (72)
PRO_H (73)
2. Division:
ADDRESS DATA
DIVIDENT (40)
DIVIDER (41)
QUOTIENT (42)
REMAINDER(43)
RESULT:
Thus the assembly language program for multiplication and division of two 8-bit
numbers were written and its outputs were verifier using MPLAB IDE simulator.