/Designs/Measuring_instruments/AWS01A/SW/SHT.c
18,7 → 18,7
//#define sht_data_pin PIN_D0
//#define sht_clk_pin PIN_D1
 
#include <math.h>
//#include <math.h>
 
 
#define noACK 0
205,7 → 205,7
 
//***** Function to measure SHT75 temperature *****
 
int16 sht_measuretemp (void)
int16 sht_measuretemp ()
{
int1 ack;
int16 iobyte;
221,7 → 221,7
 
//***** Function to measure SHT75 RH *****
 
int16 sht_measurehumid (void)
int16 sht_measurehumid ()
{
int1 ack;
int16 iobyte;
242,8 → 242,8
const float C1=-2.0468; // for 12 Bit RH
const float C2=+0.0367; // for 12 Bit RH
const float C3=-0.0000015955; // for 12 Bit RH
const float T1=+0.01; // for 12 Bit RH
const float T2=+0.00008; // for 12 Bit RH
// const float T1=+0.01; // for 12 Bit RH
// const float T2=+0.00008; // for 12 Bit RH
float rh;
 
//calculate temperature reading
285,15 → 285,15
}
 
//--------------------------------------------------------------------
float calc_dewpoint(float h,float t)
//float calc_dewpoint(float h,float t)
//--------------------------------------------------------------------
// calculates dew point
// input: humidity [%RH], temperature [K]
// output: dew point [K]
{ float k,dew_point ;
k = (log10(h)-2)/0.4343 + (17.62*t)/(243.12+t);
dew_point = 243.12*k/(17.62-k);
return dew_point;
}
//{ float k,dew_point ;
//
// k = (log10(h)-2)/0.4343 + (17.62*t)/(243.12+t);
// dew_point = 243.12*k/(17.62-k);
// return dew_point;
//}