Give this a try.
and then to display try this.Code:hum var word j var byte x var byte read_dht: TRISA.1 = 0 ' Make pin an input high dht_data '250ms High pause 250 low dht_data '20ms Low pause 20' send 20ms low high dht_data '40us High pauseus 40 PulsIn PORTA.1, 1, dht if dht < 9 then goto badresponse for x = 31 to 0 step-1 PulsIn PORTA.1, 1, dht[x] ' 1 next x hum = 0 'Clear hum variable 'Stuff values into hum word variable based on pulsewidth value in dht byte arrary j = 15 for x = 31 to 16 step - 1 for x = 31 to 16 step - 1 if dht(x)>=35 then hum.0[j] = 1 j = j - 1 next x return
Code:LCDOut $FE,$80+9,"RH ",dec hum/10, "." dec hum //10




Bookmarks