TSL 2561 I2C Kommunikationsproblem

Gast #1222375
Lesenswert?
• ▲
▼
Hallo,
ich versuche schon seit einiger Zeit den TSL2561T von Taos zum laufen zu 
bekommen. Das Teil ist ein Light-to-digital Konverter mit I2C Bus.
Datenblatt: 
http://www.taosinc.com/getfile.aspx?type=press&file=tsl2560-e58.pdf

Mittlerweile habe ich auch ansatzweise eine Kommunikation realisiert, 
was sich aber nur in völlig falschen Rüchgabewerten äußert bzw Werten 
die sich gar nicht erst ändern.

Das Bauteil hängt an einer C-Control Pro mega128 Unit. Hier mal mein 
bisheriger Quelltext nach der Vorlage im Datenblatt (S. 18 unteres 
Beispiel).
1
#define addr_licht1 0x72 //01110010 Float, laut Datenblatt Adresse des Bauteils mit ADDR-Pin im float-Zustand und Write-Mode 
2

3
int Read_TS2561(byte addr_ts2561) {
4
    int i_result;
5
    byte b_high, b_low;
6

7
    I2C_Start();
8
    I2C_Write(addr_ts2561);
9
    I2C_Write(0x8C);
10
    I2C_Start();
11
    I2C_Write(addr_ts2561+1); //Read-Mode
12
    b_low = I2C_Read_ACK();
13
    I2C_Stop();
14

15
    I2C_Start();
16
    I2C_Write(addr_ts2561);
17
    I2C_Write(0x8D);
18
    I2C_Start();
19
    I2C_Write(addr_ts2561+1); //Read-Mode
20
    b_high = I2C_Read_ACK();
21
    I2C_Stop();
22

23
    i_result = b_high << 8;
24
    i_result = i_result + b_low;
25

26
    return i_result;
27
}
28

29
//Aufruf der Funktion
30
int i_licht1;
31
i_licht1 = Read_TS2561(addr_licht1);

Was ich persönlich noch ein bisschen komisch finde ist, dass bei einer 
Write-Operation das letzte Bit der Adresse Null sein soll, laut 
Datenblatt (S. 10). Zum einen funktioniert dann überhaupt keine 
Kommunikation mehr, zum anderen habe ich das bisher noch nie so herum 
gesehen.

Wäre sehr dankbar, wenn jemand vllt einen funktionierenden Quelltext 
anbieten könnte oder den Bug findet.
Gruß Markus
Gast #1225594
Lesenswert?
• ▲
▼
ok I try my very best xD

i had some problems with the communication, I hadn't received anything 
from the tsl2561.
Since my last post I already made some progress. Now the devices 
responds but there are still problems when I tried to calculate the lux 
value of the brightness.

I attached the routine which already works and reads the two values of 
ADC0 and ADC1

remember: This is CompactC source code for the Conrad C-control Units!

markus
Angehängte Dateien:

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