Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

division of 32bit by 16bit in 8051 assembly

Status
Not open for further replies.

bramhankarrohit

Newbie level 3
Joined
Mar 1, 2012
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,304
i want to do 32 bit division by 16bit in my project to produce velocity,
as velocity= dist/time
so plz tell me how to do division of 32bit by 16 bit in 8051
 

Simple answer: use a math library (include math.h)
Slightly longer answer: If the numbers are integers, just see how many times the denominator fits into the numerator (simple loop count). It will take a while to execute of course... You could take short-cuts if your time is a power of 2 (2^1, 2^2, 2^3..) then you could just do a bit-shift operation (shifting the numerator one position to the right is equivalent to divide-by-two.
If your numbers are not integers then you could round off, or scale up, or use a math library.

EDIT: sorry, just saw you wanted to do it in assembly. Unless you can find a math routine to do this, then you'll need to implement your own, perhaps using the scheme I mentioned. Since the 8051 is fairly common, you may find a routine on the Internet if you google it.
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top