Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfacing DHT11 with PIC

Status
Not open for further replies.

engshahrul

Banned
Full Member level 6
Joined
Apr 27, 2009
Messages
329
Helped
98
Reputation
196
Reaction score
94
Trophy points
1,308
Location
Malaysia
Activity points
0
Hi, I'm trying interfacing DHT11 with PIC. I'm using Hi-Tech compiler.
From information all over datasheet and internet, after sending start signal, DHT11 will reply 5 byte data. The last one is check sum.
Code:
void dht11_start(void)
{
DataDir=0; // set pin as output
Data=0; // give low
__delay_ms(20);
Data=1;  //give high
__delay_us(30);
DataDir=1;  //set pin as input
while(Data==0) continue;
while(Data==1) continue;
}

char dht11_byte(void)
{int i;
char value=0;
for(i=0;i<8;i++){
	while(Data==0) continue;
	__delay_us(40);
	if(Data==1){
		value=value|(1<<(7-i));
		while(Data==1) continue;}
	}
return value;
}
This is my DHT11 start signal and DHT11 read byte. I give start signal and read 5 byte. Another 1, I calculate the sum of 5 byte.
Code:
sum=temp[0]+temp[1]+temp[2]+temp[3]+temp[4];
sum=sum&0xFF;
But, the value sum not equal to the fifth byte read from DHT11. Anyone know how the above function?
 
Last edited:

any one help ,,, i need dht 11 c code for 89c51,,, with example ,,,,, and protius simulation this related dht.,. sht., like

---------- Post added at 08:49 ---------- Previous post was at 08:36 ----------

any one help ,,, i used ARM 9 friendly ARM mini 2440 .. .. linex how to conect internet ? please tell me step by step,,,,
 

i need protius simulation for dht 11 or sht 11 with 89c51... how to simulate ...??? then windows 7 sum time not fully instal protious ?? with version better for windows 7?????
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top