| Electronic Components Datasheet Search |
|
SFH5721 Datasheet(PDF) 39 Page - OSRAM GmbH |
|
|
|||||||||||||||||||||||||||||
SFH5721 Datasheet(HTML) 39 Page - OSRAM GmbH |
|
39 / 54 page ![]() SFH 5721 DATASHEET DATASHEET 39 | Version 1.1 | 2022-02-28 Sample Code This section introduces you to a very basic dummy code for implementation of the Sensor. The write and read register functions are hardware dependent. The following code example shows you how to reset the sensor, do the interrupt a measurement configuration and finally how to start and get data from the sensor. Reset: // Reset Sensor to default state I2C_8_write_register(0x00, 0b10000000); // Reset in Operation selection register Example Configuration: // Example Configurate for interrupt settings I2C_8_write_register(0x02, 0b00110000); // Enable High & Low IR for ALS Channel I2C_8_write_register(0x03, 0b00100000); // Configurate IR settings I2C_8_write_register(0x04, 0b11001100); // Define Low Threshold LSB (30% of 16bit) I2C_8_write_register(0x05, 0b01001100); // Define Low Threshold MSB (30% of 16bit) I2C_8_write_register(0x06, 0b11111111); // Define High Threshold LSB (75% of 16bit) I2C_8_write_register(0x07, 0b10111111); // Define High Threshold MSB (75% of 16bit) // Example Configuration for measurement settings I2C_8_write_register(0x09, 0b00111001); // Set AGAIN=4 & IT=25ms in MCONFA I2C_8_write_register(0x0A, 0b00011000); // Set Wait=100ms & DGAIN=1 in MCONFB I2C_8_write_register(0x0B, 0b00010100); // Set LPFDEPTH=3 & enable Filter in MCONFC Enable: // Start Procedure by enabling required mode and channel I2C_8_write_register(0x00, 0b00000100); // Enable Async Continuous mode & ALS Channel Readout manually or after number of interrupts: // Read and print out sensor data from ALS Data Register Addresses of i2c address LSB = I2C_8_read_register(0x26, 0x10); // Read DATA3L register from sensor address MSB = I2C_8_read_register(0x26, 0x11); // Read DATA3H register from sensor address ALS_count = (MSB << 8) | LSB; // Shifting together LSB & MSB for ALS channel counts Print(ALS_count); // Print out ALS count |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |