Peter,
It looks like the original formula would have been
y = 0.2923x - 134.39
With a few extra decimal places.
But since you will end up with an integer in the end, you can just round off to -134 for the b parameter (y=mX + b).
For the m parameter, 0.2923 is 2923 ten thousanths. Which is an easy way to remember that you need to divide by 10,000 afterwards.
So you multiply the A/D reading times 2923.
Then divide it by 10,000
Like this...I think that's about as close as you can get with 16/31 bit math.Code:X VAR WORD Y VAR WORD ADCIN 6,X Y = X * 2923 Y = DIV32 10000 Y = Y - 134
HTH,




Bookmarks