8051 16 Bit Multiplication ALP
ALGORITHM:
- Start.
- Load the MSB’s of Data in two different registers.
- Load the LSB’s of Data in other two different registers.
- Successive multiplication is carried out.
- The product obtained in the registers.
- The output is stored in the registers.
- 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
6 thoughts on “8051 16 bit multiplication Program- Codes Explorer”