I have not done it with PBP, but in another life I did it with PICAXE BASIC.
After being queried, the DHT11 returns 41 Bits of Data. The first bit is an ACK and can be ignored. The next 16 bits are Humidity bits. ONly the first 8 of these bits are used wth the DHT-11. The next 16 bits are Temperature bits and again only the first 8 are used. The next 8 bits are the checksum.
First Bit - Ignore or use for interrupt
Bit 1 - 8 Humidity MSByte
Bit 9 - 16 Hymidity LSByte (Only used with DHT22 - Ignore - All zeros
Bit 17 - 24 Temperature MSByte
Bit 25 - 32 Temperature LSByte (Only used with DHT22 - Ignore - All zeros
Bit 33 = 40 Checksum - use if desired
The protocol is such that each bit starts with a 50us low, followed by either a 27us high Pulse or a 70us high pulse,where 27us = "0" nd 70us = "1"
These pulses can be read with pulsin and then tested with an IF statement to determine if a pulse is a 1 or a 0.
There is only 50us between bits so the PIC only has 50us to read the bit & determine if a 1 or 0 before the next bit arrives.
I am not going to write & debug the code for you if that is what you are looking for. However, below is a link to the Picaxe Basic code that may be helpful. You should not need the 555 timer or 74HC221 since PBP it is compiled code and runs much, much faster than Picaxe Basic interpreted code.
http://www.picaxeforum.co.uk/showthr...ighlight=DHT11
Bookmarks