8051 16 bit multiplication Program- Codes Explorer

8051 16 Bit Multiplication ALP 
ALGORITHM:
  1. Start.
  2. Load the MSB's of Data in two different registers.
  3. Load the LSB's of Data in other two different registers.
  4. Successive multiplication is carried out.
  5. The product obtained in the registers.
  6. The output is stored in the registers.
  7. End.
For example if we are trying to multiply two 16 bit numbers as below.We have divided 16 bit numbers into two 8 bit numbers

Basically, we are multiplying FFFF & EF9D.

But in this program,   AB = FF
                                   CD = FF
                                   EF  = EF
                                   GH = 9D
After we execute the above Program, the result will be stored in R7-R6-R5-R4.


ORG 0000H
MOV R0,#0FFH ;MSB1
MOV R1,#0EFH ;MSB2 
MOV R2,#0FFH ;LSB1
MOV R3,#9DH  ;LSB2

MOV A,R2
MOV B,R3
MUL AB
MOV R4,A
MOV R5,B

MOV A,R2
MOV B,R1
MUL AB
MOV R6,B
ADDC A,R5
MOV R5,A

MOV A,R1
MOV B,R4
MUL AB
ADDC A,R5
MOV R5,A
MOV A,B
ADDC A,R6
MOV R6,A

MOV A,R1
MOV B,R2
MUL AB
ADDC A,R6
MOV R6,A
MOV A,B
ADDC A,#00H
MOV R7,A
END

If you are facing problem reading the code.Download this code.
Click on the link below to Download


8051 16 Bit Multiplication Assembly Program File

No comments:

Powered by Blogger.