EmbDev.net

Forum: µC & Digital Electronics 16 bit division with high precision problem?


von Ya C. (Company: frau) (cherry)


Rate this post
useful
not useful
Hi, all

I use mega128 to control ad5933 chip, since now it's the last step of my 
whole project, sticking with assembly language is a better option.

I am doing damage matrix between two column of data, after I simplified 
the equation, actually I just need to calculate undamage/damage, they 
are all 16bit numbers, and because they are very close numbers, I have 
to divide out 4 or 5 decimal until I can see the difference, for 
instance(I calculated in MATLAB):

UN_1/DA_1 = 0.9993
UN_2/DA_2 = 1.0208

etc...

1. I read AVR200 unsigned 16bits division carefully, I think I can put 
the decimal in the remainder, right?
Later I will do (UN/DA)^2, assume I already save UN/DA, since mega128 
has fractional multiplication, I'd like to take advantage of it. so how 
could I convert this remainder into fractional.

2. And how many digits of remainder I need to reserve for this 
precision.

Hope someone with experience could explain to me my questions, I am 
really getting lost right now.

: Moved by Admin
von Düsentrieb (Guest)


Rate this post
useful
not useful
maybe using 32 bit math is a simple way, look at
http://www.sump.org/projects/counter/
here some 32 bit asm...

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.