- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Here we will see how to multiply two 8-bit numbers using this 8051 microcontroller. The register A and B will be used for multiplication. No other registers can be used for multiplication. The result of the multiplication may exceed the 8-bit size. So the higher order byte is stored at register B, and lower order byte will be in the Accumulator A after multiplication.

We are taking two number FFH and FFH at location 20H and 21H, After multiplying the result will be stored at location 30H and 31H.

Address | Value |
---|---|

| … |

20H | FFH |

21H | FFH |

| … |

30H | 00H |

31H | 00H |

| … |

MOV R0, #20H ; set source address 20H to R0 MOV R1, #30H ; set destination address 30H to R1 MOV A, @R0 ; take the first operand from source to register A INC R0 ; Point to the next location MOV B, @R0 ; take second operand from source to register B MUL AB ; Multiply A and B MOV @R1, B ; Store higher order byte to 30H INC R1 ; Increase R1 to point to the next location MOV @R1, A ; Store lower order byte to 31H HALT: SJMP HALT ; Stop the program

8051 provides **MUL AB** instruction. By using this instruction, the multiplication can be done. In some other microprocessors like 8085, there was no MUL instruction. In that microprocessor, we need to use repetitive ADD operations to get the result of the multiplication.

When the result is below 255, the overflow flag OV is low, otherwise it is 1.

Address | Value |
---|---|

| … |

20H | FFH |

21H | FFH |

| … |

30H | FEH |

31H | 01H |

| … |

- Related Questions & Answers
- 8051 Program to Multiply two 8 Bit numbers
- Program to Subtract two 8 Bit numbers in 8051 Microprocessor
- Program to Divide two 8 Bit numbers in 8051 Microprocessor
- 8051 Program to Divide two 8 Bit numbers
- 8051 Program to Add two 8 Bit numbers
- 8051 Program to Subtract two 8 Bit numbers
- 8085 program to multiply two 8 bit numbers
- 8086 program to multiply two 8-bit numbers
- Program to multiply two 8-bit numbers (shift and add method) in 8085 Microprocessor
- Program to Add two 8 Bit numbers in 8085 Microprocessor
- Program to Subtract two 8 Bit numbers in 8085 Microprocessor
- Program to Divide two 8 Bit numbers in 8085 Microprocessor
- Program to multiply two 16-bit binary numbers in 8085 Microprocessor
- 8085 program to multiply two 8 bit numbers using logical instructions
- 8085 Program to multiply two 8-bit numbers (shift and add method)

Advertisements