2011-01-19 03:35 AM
Read STLM75 - Temperature Sensor
2011-05-17 05:21 AM
Hi,
I think it's 5 right shifted because the choosen resolution of the digital output data is 11-bit. Then it's 3 times right shifted because that resolution correspond to temperature increments of 0.125 °C: /* Offset constants for scale temperature */ #define stts75_span (float)(0.125) // From [0.5 , 0.25 , 0.125 , 0.0625 ] #define stts75_offset (u8)(32) // From [128 , 64 , 32 , 16 ] /* Convert 2 complements integer value to float in °C */ float stts75_scale_temp(u16 temp) { float temp_result=0.0; if(temp>0) // Positive temperature ? temp_result=(float)(temp*stts75_span/stts75_offset); else // Negative temperature ? temp_result=(float)(temp*stts75_span/stts75_offset)-256; if(temp==0) // Zero ? temp_result=0.0; return temp_result; } brazov22011-05-17 05:21 AM
@bravoz.ajeje
Thank u very much for ur reply. I got the point that the 5 right shift is done based on the ADC resolution. But i didnt get the point that 3 right shift resolution leads to .125 increase in the temperature. As per the datasheet the increase in temperature is done by 0.5 C and not by .125 C. And moreover how did u fix the offset to be (u8)32? Can you please explain it in bit detail?2011-05-17 05:21 AM
Hi,
sorry, what I said was for STTS75 (I used it): look at page 6 chapter 1.2, you can see that depending on the resolution you choose, you have a certain increment step in temperature, higher bit resolution means lower temperature increment. 3 right shift = 2^(-3) = 0.125 (temperature step) 5 right shift = 2^(5) = 32 (adc resolution 11-bit)http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00153513.pdf
for STLM75 ADC resolution is alway 9-bit, so in this case: 1 right shift = 2^(-1) = 0.5 (temperature step) 7 right shift = 2^(7) = 128 (adc resolution 9-bit) brazov2