Excel Formula to PICAXE

Lliam20789

New Member
Hello everyone,
I have been experimenting with a NTC thermistor and have finally come up with a conversion formula, but...

temp=0.00032442727*w0^2-0.342224714*w0+115.3133411

will obviously not work in a PICAXE... Does anyone know how to do this?

Thankyou,
Lliam
 

Brietech

Senior Member
how accurate does it need to be? If this is a dedicated application, and you have room on your chip (or on i2c memory), you could just make a lookup table for all of the values of w0 you're likely to get.
 

Lliam20789

New Member
Doesn't need to be overly accurate and a look up table is an option.
So it is as hard as it looks to get the PICAXE to do that?

Thanks for your help so far,
Lliam
 

Dippy

Moderator
Any sort of stuff like this needs breaking down into separate small integer functions and keeping an eye on overflows and negatives.
eg. your 0.00032442727*w0 is the same as w0/3082 approx.

I think your numbers of digits may be trimmed a bit.
I would think that with tolerances of thermistors that w0+115.3133411 maybe a little OTT. How about just w0+115?

So, split it into smaller functions, check for possiblity of overflows etc, then add them back together.
Go on, give it a go. Be brave and get the pen and paper out.
 

Jeremy Leach

Senior Member
If you actually draw this out as a graph (or in Excel) you might spot a much simpler formula you could use which will give a good enough result.
 

Lliam20789

New Member
Thanks

I tried getting a simpler formula but I'm all out of ideas...
I can try Dippy's idea but I'm not the greatest at maths.

I'll let you know how I go.

Thankyou all for you help,
Lliam
 
Top