DHT20 initialisierungsprozess keine Informationen

Gast #7136304
Lesenswert?

guten morgen,

kennt jemand die initial routine von einem DHT20 ?

Im Datenblatt ( 
http://aosong.com/userfiles/files/media/Data%20Sheet%20DHT20%20%20A1.pdf 
) steht,
1
7.4 Sensor Reading Process
2
1.After power-on, wait no less than 100ms. Before reading the temperature and humidity value, get a byte of status
3
word by sending 0x71. If the status word and 0x18 are not equal to 0x18, initialize the 0x1B, 0x1C, 0x1E registers,
4
details Please refer to our official website routine for the initialization process; if they are equal, proceed to the next
5
step.

mit einem kleinen Pythonscript auf dem RPI wollte ich das teil in 
betrieb nehemen und testen, bevor ich es an einem Mikrocontroller 
anschliße.
1
import time
2
import smbus
3

4
address = 0x38
5

6
i2cbus = smbus.SMBus(1)
7
time.sleep(0.5)
8

9
data = i2cbus.read_i2c_block_data(address,0x71,1)
10
print('data: ', data[0])

data[0] ist gleich 28,
also 0x1C, also ungleich 0x18
wie muss ich denn die Register 0x1B, 0x1C, 0x1E jetzt initialisiren?

es steht, dass man auf der webseite für die initialisierungsprozess was 
findet. Aber dort habe ich nichts gefunden. gehört so etwas nicht aber 
auch ins Datenblatt (egal ob von china oder nicht)?
Gast #7136322
Lesenswert?

Johannes schrieb:
> If the status word and 0x18 are not equal to 0x18

Ich würde das hier so interpretieren dass ein bitweises AND gemeint ist, 
also das status word muss nicht genau 0x18 sein, sondern "status word 
AND 0x18" sollte am ende 0x18 ergeben, also mindestens die Bits der 
Maske 0x18 sollten gesetzt sein. Und genau das ist bei 0x1C der Fall. Im 
Datenblatt sieht man auch dass das extra Bit das gesetzt ist für 
"Calibrated" steht.
Gast #7136348
Lesenswert?

Bitverschwörung schrieb:
> Ich würde das hier so interpretieren dass ein bitweises AND gemeint ist,
> also das status word muss nicht genau 0x18 sein, sondern "status word
> AND 0x18" sollte am ende 0x18 ergeben, also mindestens die Bits der
> Maske 0x18 sollten gesetzt sein.

ahso, ja, so kann es auch gemeint sein.
Dann funktioniert mein code ja schon :)

dann hätten die es aber auch anders schreiben können, dass genau diese 
bits gesetzt sein müssen.
Haben die im 3 Punkt auch gemacht. Das ist für mich deutlicher
1
3.Wait 80ms for the measurement to be completed, if the read status word Bit [7] is 0, it means the measurement is
2
completed, and then six bytes can be read continuously; otherwise, continue to wait.

Ich danke dir für deinen Hinweis

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren