DLP-THS-T DLP Design Inc, DLP-THS-T Datasheet - Page 4
DLP-THS-T
Manufacturer Part Number
DLP-THS-T
Description
Industrial Temperature Sensors TEMP SENSOR MODULE
Manufacturer
DLP Design Inc
Datasheet
1.DLP-THS-H.pdf
(6 pages)
7.0 CALCULATION METHODS
The following example code shows how to calculate temperature and humidity if returning data in the
binary mode:
void calctemp(int mode, int MSByte, int LSByte, float *degc)
{
}
double calchum(int MSByte, int LSByte, float degc)
{
}
Rev. 1.4 (August 2008)
int degc_temp;
int isnegative;
if(mode == 0) // Humidity Sensor
{
}
if(mode == 1) // Temperature only sensor
{
}
//the degc parameter is the temperature from the humidity sensor
int hum_temp;
double rhtrue, rhlin;
double tempC;
hum_temp = LSByte | (MSByte << 8);
tempC = (float)(( -40.00 + (0.01 * (double)degc)));
rhlin = -4.0 + (.0405*(float)hum_temp) + (-2.8e-6*(float)hum_temp*(float)hum_temp);
rhtrue = (tempC - 25.0) * (.01 + .00008 * hum_temp) + rhlin;
return rhtrue;
degc_temp = LSByte | (MSByte << 8);
*degc = (float)(( -40.00 + (0.01 * (double)degc_temp)));
degc_temp = MSByte | (LSByte << 8);
isnegative=0;
if( (degc_temp & 0x8000) == 0x8000 )//if MSBit is set then negative temperature
{
}
degc_temp &= 0x07ff;
*degc = (float)((float)degc_temp/16.0);
if(isnegative)
degc_temp &= 0x07ff;
isnegative=1;
degc_temp = 0x800 - degc_temp;
*degc *= -1.0;
4
© DLP Design, Inc.