a) Declare your variables as WORDSMy calculation is
shotspersecond = count / seconds
b) Multiply count by something like 100 or 1000. This shifts the decimal place to the right. Pick a multiplier that will keep the result below 65536.
b) Now, do the divide: shotspersecond = count / seconds.
c) Display shotspersecond with something like:
LCDOUT DEC shotspersecond/100, ".",DEC2 shotspersecond//100
The key is to shift the decimal place prior to the division, then adjust the display to account for the shift.
For more reading (and a better example of integer math), take a look at These threads from Darrel Taylor:
Retrieving 32bit Multiply Result
Retrieving Div32 Remainder
32-bit Variables and DIV32, Hourmeter 99999.9.
You might also try a search for integer math.
HTH,
Steve
Bookmarks