Draystone
Well-Known Member
Not that you need this accuracy but, here's a bit of code I wrote in the last century
It should work for Pt1000 type 501 if you just change the R0 constant to 1000.00.
It assumes you're happy to use floating point and you have a resistance value in ohms which you may not want to bother with.
It should work for Pt1000 type 501 if you just change the R0 constant to 1000.00.
It assumes you're happy to use floating point and you have a resistance value in ohms which you may not want to bother with.
C:
//
//Convert r to t for Pt100 type 404
//Parameters:
// r = resistence in ohms
//Returns :
// temperature in deg C
// -9999.99 if sqrt error predicted.
//
double pt100lin(double r)
{
double t;
const double A = 3.90802e-3 ;
const double B = -5.80195e-7 ;
const double R0 = 100.00 ;
t = A * A - 4.00 * B * ( 1 - r / R0 ) ;
if ( t < 0.0 )
{
// Trap sqrt error
return( -9999.99 );
}
t = ( -A + sqrt( t ) ) / ( 2.00 * B );
return(t);
}
Last edited:




