![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| 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. | |
| |
| | (permalink) |
| 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); | |
| |