Hello all!
So, the question is can I express the function f(x) = 0.0206x + 0.2867? I have been trying to think of a way of doing it but I do not think it is easy, or even possible with decent accuracy. The domain of x belongs to the set {0,1,2,3,....6000}. The range belongs to the set {0,1,2,3,....124}.
I need this because this equation converts frequency from the VSS wire of a 2003 Acura TL to miles per hour. I know the function is accurate as I actually computed the values in excel and "hard coded" it to the picaxe by using a painfully long select...case code block. Then I interfaced the picaxe to the VSS wire, found the frequency of the signal, used my select...case conversion table, and outputted the result to a LCD screen. I was able to read the speed from 0-99 very accurately
As you guys can imagine, the select...case code block was a memory hog (1730 bytes of program memory to be exact). I tried to look up on how I could multiply by a decimal, and the closest I got was winding up on the parallax website. I read there that the operator */ could be used to achieve close to floating point calculation and the X1 and X2 parts have this operator I think so I guess I could use this "trick". Admittedly, I did not fully understand how I could use the */ operator to do this.
Anyone got any good hints?
So, the question is can I express the function f(x) = 0.0206x + 0.2867? I have been trying to think of a way of doing it but I do not think it is easy, or even possible with decent accuracy. The domain of x belongs to the set {0,1,2,3,....6000}. The range belongs to the set {0,1,2,3,....124}.
I need this because this equation converts frequency from the VSS wire of a 2003 Acura TL to miles per hour. I know the function is accurate as I actually computed the values in excel and "hard coded" it to the picaxe by using a painfully long select...case code block. Then I interfaced the picaxe to the VSS wire, found the frequency of the signal, used my select...case conversion table, and outputted the result to a LCD screen. I was able to read the speed from 0-99 very accurately
As you guys can imagine, the select...case code block was a memory hog (1730 bytes of program memory to be exact). I tried to look up on how I could multiply by a decimal, and the closest I got was winding up on the parallax website. I read there that the operator */ could be used to achieve close to floating point calculation and the X1 and X2 parts have this operator I think so I guess I could use this "trick". Admittedly, I did not fully understand how I could use the */ operator to do this.
Anyone got any good hints?