YES. I see what you mean
COULD BE BETTER: Kind of understand what your trying to say
NO: What the heck are you talking about
Hey Skimask
I care because its relevant to something I am working on now.... To find the perfect thread....only to discover you have been led up the garden path, haha. Not to worry, I did see a few other relevant posts elsewhere.
Cheers
Tony
Hi!
I know this is an old thread but this might still help someone.
NavMicroSystems' example works fine, if you place wx=wy<< bt+(bt & wx.bit15)
instead of wx=(wy< Next.
It has some issues with negative temperatures but ok...
It's important that you don't forget 10k pullup on DTA line.
There's one more thing: you should replace all HIGH dta
commands with INPUT dta.
Datahseet SHT1x @ page 5.
"To avoid signall contention the microcontroller must only
drive DATA low".
When you have appropriate (10k) pullup on dta the line
goes high if you set the dta pin to input. I tested it and
it works perfectly fine.
Also: if this is your first attempt to communicate with SHT1x maybe
you should consider omitting dewpoint calculations and just read
raw data.
For room ambient (i had about 22°C and 35 %RH when testing) you should
get readings like 0x1855 for 14bit temperature and 0x03EE for 12bit humidity).
Best regards,
Rok
Last edited by psenek; - 26th January 2011 at 10:47.
I want to program SHT11, with language PBP or Pbasic
want to know the temperature and humidity with SHT11.
please help me ....
I have successfully used the code below with an 18F2321.
It should work the same with a 16F part.
I found it somewhere here on the forum, and it works great.
Code:'------------------ Read SHT71 Temperature / Humidity Sensor ------------------- ReadSHT71: SHTCommand = ReadTemp gosub Initialize GOSUB TransmissionStart GOSUB IssueCMD gosub ConvertToCelsius SHTCommand = ReadHumidity gosub Initialize GOSUB TransmissionStart GOSUB IssueCmd gosub ConvertToRH TEMPC = (TempC/100) - 2 TempC.7 = SignC RHTempComp = RHTempComp/100 RETURN '--------------------- Calculate Relative Humidity ----------------------------- ConvertToRH: ' 12 Bit RHLinear = -4 + 0.0405 * DataOutput -0.0000028 * DataOutput^2 w = 405 * RawData w = div32 100 x = RawData * RawData x = div32 1000 x = x * 28 x = div32 100 RHLinear = w - x - 400 '---------- Calculate Relative Humidity with Temperature Compensation ---------- w = (8 * RawData + 1000) / 10 IF SignC = 0 THEN ' "+" if tempC > 2500 then x = (tempC - 2500) * w x = div32 100 RHTempComp = RHLinear + x / 100 else x = (2500 - tempc) * w x = div32 100 RHTempComp = RHLinear - x / 100 endif else x = (2500 + tempC) * w x = div32 10000 RHTempComp = RHLinear - x endif return '---------------------------- Initialize the Sensor ---------------------------- Initialize: high DataPin ; Start condition low clk for i = 1 to 10 high clk pause 1 low clk pause 1 next i ; Leaves clock low return '---------------------------- Get Data from Sensor ----------------------------- IssueCmd: Pause 2 low Clk shiftout DataPin,clk,1,[SHTCommand\8] ' Send command byte input DataPin WaitForAck: x = 0 WaitForAck2: IF DataPin = 1 THEN x = x + 1 if x = 0 then goto NoAck Pauseus 2 GotoWaitForAck2 ENDIF High Clk pause 10 ' Issue ACK from PIC low clk pause 10 ' Make certain we don't move forward on a glitch WHILE DataPin:WEND shiftin DataPin,clk,0,[RawData.byte1\8] ' Get the first byte, 8 bits low DataPin HIGH Clk PAUSE 10 LOW Clk pulsout clk,10 ' Send NACK shiftin DataPin,clk,0,[RawData.byte0\8] ' Get the second byte, 8 bits low DataPin pulsout clk,10 ' Send acknowledge shiftin DataPin,clk,0,[crc\8] ' Get third byte, 8 bits, CRC high DataPin pulsout clk,10 ' Send acknowledge input DataPin ' End of Transmission input clk ERR = 0 return NoAck: ERR = 1 RETURN '---------------------------- Start Transfer ----------------------------------- TransmissionStart: HIGH DataPin ; Make sure it is high Pause 1 high clk pause 1 low DataPin pause 1 low clk pause 1 high clk pause 1 high DataPin pause 1 low clk return '----------------------------- Raw Data to Degrees C --------------------------- ConvertToCelsius: ' 14 Bit Temperature = -40.00 + 0.01 * DataOutout if RawData => 4000 then tempC = RawData - 4000 SignC = 0 else tempC = 4000 - RawData ; Negative Temps SignC = 1 endif return
Charles Linquist
what software you use as a compiler?
pardon my beginner programing and
program how to display the sensor readings of temperature and humidity SHT11 to 16bit and two-line LCD ....
thanks very much
Last edited by yohanfx; - 11th April 2011 at 02:54.
Hi ,
I am going to implemant the dew point computation with this sensor and with a PIC baděsic Pro.
I agree that there is an errot in DP calculation when the temperature is under 0°C.
Any help to solve the problem? Or any updated code ?
Thanks for helping.
Regards,
Ambrogio
Bookmarks