89c51 32-bit Math calculation

Status
Not open for further replies.

garg29

New Member
Hi friends,
please, help me for a math problem, i need to calculate:-

(55299539) / ((a*100 + b)*61375 +c)

where a = 0 to 8
b= 0 to 100
c = 0 to 61375

using 89c51 assembly progrmming. what algorithm should i use?
can anyone please provide me a code?

thank you.
 
You can get a free 8051 C compiler here: http://sdcc.sourceforge.net/

C will let you just type in the equasion just like you have it. The compiler generates all the assembly to do the 32 bit computations. Just cast your variables into longs.

You should also check that a,b, and c don't all equal 0 at the same time or it will generate an error.

Code:
unsigned char a,b;
unsigned int c;
unsigned long d;
a = something;
b = something_else;
c = a_third_thing;
d = (55299539) / ((((long)a*100 + ((long)b)*61375 +((long)c);

the casts ((long)a) arn't really nessesary but I like to put them in to avoid any confusion.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…