Your approach is probably possible on a PIC, although you don't say which one you're thinking of using, but on small micros I would think looking up the temperature in a table would be more practical. Tim McDonough -- timmed@cencom.net On Mon, 13 Mar 1995, James L. Johnson wrote: > Hello, > > I am going to try to implement the solution to the Steinhart-Hart > equation using a PIC. This equation gives the relationship between > the resistance of a negative-temperature-coefficient thermistor and > its temperature. It is an empirically determined equation, so is > only an approximation to the relationship between resistance and > temperature. But, it is quite accurate over a large range as long > as the coefficients are accurate. The thermistor manufacturer gives > you the coefficients so all you have to do is plug in the numbers. > > This is a no-brainer in any high level language and we have it running > in BASIC here in our lab. However, it's probably rocket science to get > it to work in a PIC. At least it seems like it to someone who has no > experience in programming microcontrollers (me). > > Can someone give me some advice on how to do this? Are there pieces > of code already written which can do parts of this (natural log, for > example)? Are there pitfalls which make it harder than it looks or am > I over-estimating the effort here? > > The equation is: 1/T = a + b(ln R) + c(ln R)^3 where T is in Kelvin, > a,b, and c are the coefficients provided by the manufacturer, R is the > resistance in ohms, and the notation "ln" is the natural logarithm > (base e). I assume the "cubed" term can be done by doing three > "multiplies" but I don't know about the log and the reciprocal. > > Thanks, in advance, to anyone who can get me started on this! > > Jim Johnson > jjohnson@hpl.hp.com >