Quote Originally Posted by paul borgmeier View Post
Skimask,
Although it is late now, here is something I would try ...
Bash out all the constants as you noted ( 604.365, 710.734). You are left with
604.365VSS/MAF and 710.734VSS/MAF
Multiply these by 10 and keep the integer part (for added accuracy).
Const = 6044 or 7107
ANS = CONST * VSS
ANS = DIV32 MAF
Then use Darrel's trick to retrieve the remainder
http://www.picbasic.co.uk/forum/showthread.php?t=48
Put it back together as needed (Darrel shows this in his thread). This skips even the pain of Fixed Point if it works for you.
Do you need to use the answer in additional math or just display it?
What accuracy do you need?
If you want to pursue Fixed Point then the standard 24.8 format would work (2 word variables)
Oh, it's too late to guess - I'll try that tomorrow - over and out

EDIT: MAF would have to be greater than or equal to 23 or 27 (depending on 6044 or 7107, respectively) in order for the DIV32 result to be less than 65536 - if they were not, you would have to tweak the math or check the ratio of VSS/MAF before the mult / DIV32 - clear as mud?
That Darrel trick is fairly slick. I'm going to use that one in the future.
I'd like it accurate down to +/- .01, but +/- .1 will do for now. In the end, like everything, I'd like as much accuracy as I can get as these results will be accumulated over time (don't we all hate tolerance stack-up).

And I thought of the MAF/VSS ratios and overflowing out of 16 bits thing. I might end up having to divide the 2 parts down or multiply them up a bit before the final DIV32. If I have any code space left over, I'm going to throw a couple of checks in there. If MAF/VSS won't overflow the end result, I go here, if they will, I go there.

I'm still looking over the FP routines to see if they're what I need or if I get to reinvent the wheel again