Problem to divide two 16 bit numbers in 8051 series microcontrollers

Click For Summary

Discussion Overview

The discussion centers on the challenge of coding a division algorithm for two 16-bit unsigned integers in the 8051 series microcontrollers, specifically the DS80C320-ECG. Participants explore the understanding of the division process, the algorithm's implementation, and the associated coding challenges.

Discussion Character

  • Homework-related
  • Technical explanation
  • Conceptual clarification

Main Points Raised

  • One participant expresses confusion about the calculations required to find the quotient and remainder in the division process.
  • Several participants inquire whether the task is a homework assignment and suggest understanding long division principles, extending them to binary.
  • There are suggestions to follow the binary division algorithm on paper before coding it in assembly language.
  • Some participants recommend reviewing the 8051 instruction set and starting with simpler tasks before tackling multi-byte division.
  • Another participant suggests educational resources, including videos by Ben Eater, to enhance understanding of hardware and software operations related to microcontrollers.

Areas of Agreement / Disagreement

Participants generally agree on the importance of understanding the underlying principles of binary division and the need for practice. However, there is no consensus on the specific approach to take or the level of difficulty of the task.

Contextual Notes

Some participants note the potential complexity of multi-byte division and suggest starting with simpler problems, indicating a range of experience levels among participants.

Who May Find This Useful

This discussion may be useful for beginners in microcontroller programming, particularly those working with the 8051 series and interested in understanding binary division algorithms.

Stonestreecty
Messages
20
Reaction score
3
TL;DR
Code in 8051 microcontroller Problem: How to understand "Division of two 16 bit unsigned integers being in the internal memory, quotient and remainder should be stored".
Hi all,
I have a project to code in 8051 series, DS80C320-ECG (data source as reference): "Division of two 16 bit unsigned integers being in the internal memory, quotient and remainder should be stored".
DS80C320-ECG Image.jpg

I find a way to do it but there is a part of the program that i don't understand, I attach it.
I've noted which part i don't understand. By "don't understand", means that I'm not understanding why do we have to do all those calculations to find the quotient and the remainder.

Is there anyone have ideas of it? Thanks in advance.
 
Technology news on Phys.org
Is this assignment homework?
Do you understand long division?
https://en.wikipedia.org/wiki/Long_division
You can extend that to binary.
Do a trial subtract, record 1 if it stayed positive or revert and shift if trial was negative. Do that trial subtract 16 times, as you shift it to the right.

I see no code attachment.
 
Baluncore said:
Is this assignment homework?
Do you understand long division?
https://en.wikipedia.org/wiki/Long_division
You can extend that to binary.
Do a trial subtract, record 1 if it stayed positive or revert and shift if trial was negative. Do that trial subtract 16 times, as you shift it to the right.

I see no code attachment.
yep...the basic principle of binary division in a computer is similar to one of the "long division" methods using pencil and paper.
 

Attachments

You did not say if it was homework.

I think you should follow the algorithm on a sheet of paper in binary, then code it in assy. You will not learn much by copying existing code.

What do you not understand?
 
yep, it is a good learning experience as a beginner, I just want to make attempt at understanding the program.
 
I would also like to suggest that you try the videos produced by Ben Eater. He can teach you both the hardware and software side of computer operations, including micro code, software, interfacing, and even building a 6502 computer from scratch if you want to go that far.

https://www.youtube.com/user/eaterbc
 

Similar threads

Replies
6
Views
4K
  • · Replies 32 ·
2
Replies
32
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 13 ·
Replies
13
Views
5K
  • · Replies 1 ·
Replies
1
Views
4K