DHT11 question ?

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello guys,

Do I make a correct definition here ?

//setup parameters
#define DHT11_DDR_IN DDRC = 0x00;
#define DHT11_DDR_OUT DDRC =0x80;
#define DHT11_PORT_H PORTC =0x80;
#define DHT11_PORT_L PORTC =0x00;
#define DHT11_INPUTPIN PC7

Any clues ?

thanks

Last Edited: Fri. Mar 14, 2014 - 01:16 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Definition of what???
You have a salae logic analyser , so why not use it? Use some port pins to output your recovered data and sample time and you can see where your code goes wrong. Learn how to solve your own problems.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried to follow:

	//reset port
	DHT11_DDR_OUT;
	DHT11_PORT_H; //high
	_delay_ms(100);
	//send request
	DHT11_PORT_L; //low
	_delay_ms(18);
	DHT11_PORT_H;//high
	
	_delay_us(40);
	DHT11_DDR_IN;//input

but I can't see 40us on H at salae

on datasheet :

it's only 100ms H and 18ms LOW

Where's 40us HIGH ??

any ideas ?
thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your dht11 could be dud and have you checked your wiring?
Have you tried a little bit more than 18ms?

Have you tried arduino code to test it?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

with arduino code and arduino board, there's no problem....I don't understand....??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

it works with 100ms H and 18ms L then 10ms H and 5ms L
but doesn't work on uS, any clues ? thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You may not be giving it enough startup time and time between operation. Since it works with the arduino, did you think to use the logic analyser on that? Did you look at the arduino code when you wrote yours? I know i did when writing some code for a lpc1114

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

it works fine on arduino,
yes I tried to follow the code from arduino..

Quote:
time between operation

??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The datasheet section 6 tells you not to sample faster than 1 second. You seem to be doing 10 times that. Look at the signal when running arduino code.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

on arduino I got :

So I must make the first time H position for 2 seconds ?

It's from DHT11 on arduino.....abit difficult to see..??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why do you ask these questions when you can easily test them yourself?