Lichtsensor I2C

Antworten
thcweb
Beiträge: 136
Registriert: Dienstag 14. Oktober 2008, 22:59

Lichtsensor I2C

Beitrag von thcweb » Samstag 29. November 2008, 22:18

Hallo,

ich möchte die Lichtstärke bei PL erfassen.

Von Conrad gibt es unter der Bestellnummer http://www.conrad.de/goto.php?artikel=178448 ein Lichtsensor für den I2C Bus.

Leider habe ich es mit meinem einfachen I2C Bus Kentnissen noch nicht geschafft diesen über den CH341 zu laufen zu bekommen.

Ich hoffe das einer von euch bei dem sche... Wetter draußen die Zeit hat mir bei dem Problem zu helfen.

Danke im voraus.

Thomas
Dateianhänge
178448-da-01-en-UMG-LICHTSENS_TSL2561D_TMB-6_I2C-BUS.zip
Datenblatt Lichtsensor
(196.38 KiB) 348-mal heruntergeladen

abacom
Site Admin
Beiträge: 3917
Registriert: Dienstag 23. September 2008, 10:54
Kontaktdaten:

Re: Lichtsensor I2C

Beitrag von abacom » Montag 1. Dezember 2008, 10:03

Das Wesentlichste steht auf Seite 18 des Datenblatts:

Code: Alles auswählen

Basic Operation
After applying VDD, the device will initially be in the power-down state. To operate the device, issue a command
to access the CONTROL register followed by the data value 03h to power up the device. At this point, both ADC
channels will begin a conversion at the default integration time of 400 ms. After 400 ms, the conversion results
will be available in the DATA0 and DATA1 registers. Use the following pseudo code to read the data registers:
// Read ADC Channels Using Read Word Protocol − RECOMMENDED
Address = 0x39 //Slave addr – also 0x29 or 0x49
//Address the Ch0 lower data register and configure for Read Word
Command = 0xAC //Set Command bit and Word bit
//Reads two bytes from sequential registers 0x0C and 0x0D
//Results are returned in DataLow and DataHigh variables
ReadWord (Address, Command, DataLow, DataHigh)
Channel0 = 256 * DataHigh + DataLow
//Address the Ch1 lower data register and configure for Read Word
Command = 0xAE //Set bit fields 7 and 5
//Reads two bytes from sequential registers 0x0E and 0x0F
//Results are returned in DataLow and DataHigh variables
ReadWord (Address, Command, DataLow, DataHigh)
Channel1 = 256 * DataHigh + DataLow //Shift DataHigh to upper byte
ABACOM support

Antworten

Zurück zu „Lichttechnik“