Im Netz habe ich ein Beispiel Code vom arduino gefunden:
http://www.phanderson.com/arduino/hih6130.html
Datenblatt:
http://www.farnell.com/datasheets/1676947.pdf
Ich habe einen RP6 an dem ich über I2C einen Feuchtesesnor angeschlossen
habe, den HIH-6130. Die kommunikation zwischen RP6 und HIH-6130 läuft,
jedoch erhalte ich keine Werte. Der Status Bit sagt "01", laut
Datenblatt heißt das:
>When the two status bits read “01”, “stale” data is indicated.
>This means that the data that already exists in the sensor’s
>output buffer has already been fetched by the Master, and has
>not yet been updated with the next data from the current
>measurement cycle. This can happen when the Master polls
>the data quicker than the sensor can update the output buffer.
Die Erklärung zum Feuchtesensor:
http://www.phanderson.com/arduino/I2CCommunications.pdf
Ich verstehe das nicht warum dort alte Werte sein sollen :-S kann mir da
jemand vielleicht weiterhelfen. Meine vrmutung ist das "Measurement
Request", aber das habe ich in meiner Programmierung bedacht. Hier mein
Code vom RP6:
1 | #include "RP6ControlLib.h"
|
2 | #include "RP6I2CmasterTWI.h"
|
3 |
|
4 | int main(void)
|
5 | {
|
6 | initRP6Control();
|
7 | I2CTWI_initMaster(100);
|
8 |
|
9 | while(true)
|
10 | {
|
11 | uint8_t honeywell[4];
|
12 |
|
13 | I2CTWI_transmitByte(0x4E,0x00);
|
14 | mSleep(50);
|
15 | I2CTWI_readBytes(0x4F, honeywell, 4);
|
16 |
|
17 | writeString_P("\nFeuchtH: ");
|
18 | writeInteger(honeywell[0], DEC);
|
19 | writeString_P("\nFeuchtL: ");
|
20 | writeInteger(honeywell[1], DEC);
|
21 | writeString_P("\nTempH: ");
|
22 | writeInteger(honeywell[2], DEC);
|
23 | writeString_P("\nTempL: ");
|
24 | writeInteger(honeywell[3], DEC);
|
25 |
|
26 | writeChar('\n');
|
27 | mSleep(100);
|
28 | }
|
29 | return 0;
|
30 | }
|
Als ergebniss erhalte ich immer:
01 für das Status
000000 für feuchte high
00000000 für feuchte low
00000000 für temp high
000000 für temp low
10 "Do not care" lauf Datenblatt