Problem to divide two 16 bit numbers in 8051 series microcontrollers

Click For Summary
SUMMARY

The discussion focuses on implementing division of two 16-bit unsigned integers in the 8051 series microcontroller, specifically the DS80C320-ECG. Participants emphasize the importance of understanding binary long division and suggest following the algorithm manually before coding in assembly language. Key resources include the 8051 instruction set and educational videos by Ben Eater for foundational knowledge. The consensus is that mastering this division technique is crucial for beginners in microcontroller programming.

PREREQUISITES
  • Understanding of binary long division
  • Familiarity with the 8051 assembly language
  • Knowledge of the 8051 instruction set
  • Basic programming skills in microcontroller environments
NEXT STEPS
  • Study the 8051 instruction set at Keil
  • Learn binary long division techniques
  • Practice simpler division algorithms before tackling multi-byte division
  • Watch Ben Eater's educational videos on microcontroller operations at YouTube
USEFUL FOR

This discussion is beneficial for beginners in microcontroller programming, particularly those working with the 8051 series, as well as educators and students looking to deepen their understanding of binary arithmetic and assembly language coding.

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