As all numbers in your eqasion are decimal and the microcontroller will perform calculations on HEX numbers you will have to convert these numbers from decimal to HEX.
With numbers up to 255d there is no problem ( a and b).
With big costance such as 55299539 you can use windows calculator and convert them to HEX:
55299539 d = 03h 4Bh 0CDh 0D3h
61375 d = 0EFh 0BFh
But for c you will need DEC to HEX converter subroutine. Try to find it somewhere, if not I did it some time before and you can have it..
Having these numbers converted try to find 40-bit/24bit division, but first you will have to calculate the value in brackets using 32-bit MUL and SUM subroutines..
Little bit long but not impossible..
Thanks a lot for replying.
"Ianp" i think i need routines for 32-bit division also. actually i want to design a rpm meter (tachometer) ranging from 1 rpm to 10000 rpm. i'm planning to use 11.0592mhz xtal, and a disc mounted on motor shaft having one hole with IR encoder-decoder . for this if i run counter between two succesive pulses i obtain maximum readibilty of 843.4 rpm, any speed slower than this will make the counter overflow. so for 1 rpm i plan to make cascading with two more registers (R1, R0 one upto 100 and other upto 8 ) , which increments after each overflow then second register increments. so,
60 * 1000000 * 1000
------------------------------------------------------------- = rpm
[(R0*100 + R1) * 61444 + Counter0] * 1085
For motor RPM you don't need very complicated calculatons..
First you need 60sec time base and I don't want to repeat this issue once more; you will find it in this forum under "1 second Interrupt from 8051?" (search "1s AND 8051")
Once you have the 1s time base multiply it by 60 for 1min. For 1rpm you will need at least 1m time base..
And now just count pulses from the motor shaft..
The count of pulses over 1m is the RPM.
You will need 2 registers to obtain the 10000 mark..
So the mathematical operations involved are:
SUM to calculate Time Base
SUM to count pulses.
Thanks a lot for replying. "Ianp" i think the method you told is no doubt very correct, but i think the refreshing rate would be 1 minute which would be to slow. right? and the error could increase upto 1 rpm !!!
You can do it every 0.1s, 1s etc. and mulitply result by 600, 60 ....
Insread o having only 1 hole in your encoder you can have 2,3,4,.. holes and this will give you several pulses per revolution.
Of-the-shelf rotary encoders have 100, 200, .. , 1000+ ppr so the error is reduced to acceptable minimum..