| поискавой системы для электроныых деталей |
|
SFH7773 датащи(PDF) 21 Page - OSRAM GmbH |
|
|
|||||||||||||||||||||||||||||
SFH7773 датащи(HTML) 21 Page - OSRAM GmbH |
|
21 / 23 page ![]() December 12, 2011 page 21 of 23 C-code for main program: // ALS: I2C_w_3 (0x38*2, 0x80, 0x03); // ALS free running mode I2C_w_3 (0x38*2, 0x86, 0x00); // new data every 100 ms I2C_w_3 (0x38*2, 0x98, LB_LL); // setting low byte of low ALS limit I2C_w_3 (0x38*2, 0x99, HB_LL); // setting high byte of low ALS limit I2C_w_3 (0x38*2, 0x96, LB_HL); // setting low byte of high ALS limit I2C_w_3 (0x38*2, 0x97, HB_HL); // setting high byte of high ALS limit // Prox: I2C_w_3 (0x38*2, 0x81, 0x03); // Prox free running mode I2C_w_3 (0x38*2, 0x82, 0x1E); // IR LED with 200 mA I2C_w_3 (0x38*2, 0x85, 0x00); // new data every 10 ms I2C_w_3 (0x38*2, 0x93, Prox_Limit); // setting byte for high prox limit I2C_w_3 (0x38*2, 0x92, 0x03); // interrupt triggered by PS and ALS, latched and ground when active // Interrupt routine: // called when interrupt happened I2C_w_2_r_1 (0x38*2, 0x8E); // reading Status Register, Function returns register value as variable Content if ( (Content & 0x80) == 0x80) // &=bitwise AND,check whether ALS triggered interrupt { I2C_w_2_r_1 (0x38*2, 0x8C); // read low byte of ADC, register 0xC Content1 = Content; I2C_w_2_r_1 (0x38*2, 0x8D); // read high byte of ADC, register 0xD Lux = Content * 256 + Content1; } Else // Interrupt must be caused by prox sensor { I2C_w_2_r_1 (0x38*2, 0x8F); // read Prox data register 0x8F Prox = Content; // Value in uW/cm^2 =10power(Content/51) } // end of interrupt routine 12.4 Implementation into a Mobile Phone Environment Below are two example flowcharts, describing how the SFH 7773 can be implemented into a microcontroller based mobile phone environment. The interrupt function allows for low-power stand-alone operation of the device. The first flowchart illustrates a possible operation of the ambient light sensor, the second flowchart relates to the operation of the proximity sensor. 12.4.1 Operation of the ALS Fig. 21 illustrates a flowchart for a microcontroller based ambient light sensing example. The interrupt (set to active low) alerts the microcontroller only in case the actual ambient light value is outside of the defined ALS window. Using the interrupt functionality and operating the SFH 7773 in the free-running mode helps to minimize traffic on the I2C-bus as well as to relieve the microcontroller from unnecessary work load. This arrangement helps to save valuable battery power. By adapting dynamically new thresholds (with hysteresis) relative to the actual ALS value (after an interrupt event took place) it is possible to define very fine steps for adapting the display brightness (quasi- continuous). By inverting the interrupt polarity (register 0x92) the interrupt alert function can be inverted from outside the ALS window to |
|
|
ссылки URL |
| Вашему бизинису помогли Аллдатащит? [ DONATE ] |
Что такое Аллдатащит | реклама | контакт | Конфиденциальность | Ссылка на техническое описание | обмен ссыками | поиск по производителю 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 |