Electronic Components Datasheet Search
  English  ▼

X  

SFH7773 Datasheet(PDF) 20 Page - OSRAM GmbH

Part # SFH7773
Description  (IR-LED Proximity Sensor Ambient Light Sensor)
PDF  23 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  OSRAM [OSRAM GmbH]
Direct Link  http://www.osram.com
Logo OSRAM - OSRAM GmbH

SFH7773 Datasheet(HTML) 20 Page - OSRAM GmbH

Back Button SFH7773 Datasheet HTML 15Page - OSRAM GmbH SFH7773 Datasheet HTML 16Page - OSRAM GmbH SFH7773 Datasheet HTML 17Page - OSRAM GmbH SFH7773 Datasheet HTML 18Page - OSRAM GmbH SFH7773 Datasheet HTML 19Page - OSRAM GmbH SFH7773 Datasheet HTML 20Page - OSRAM GmbH SFH7773 Datasheet HTML 21Page - OSRAM GmbH SFH7773 Datasheet HTML 22Page - OSRAM GmbH SFH7773 Datasheet HTML 23Page - OSRAM GmbH  
Zoom Inzoom in Zoom Outzoom out
 20 / 23 page
background image
12.1.3 Subroutine I2C_w_2_r_1
void I2C_w_2_r_1 (unsigned char addr, unsigned char com)
{
unsigned char var;
OpenI2C (MASTER, SLEW_ON);
SSPADD
= 0x27;
StartI2C ();
IdleI2C ();
var = WriteI2C(addr);
if (var ==
0) read_s++;
if (var == -1) read_c++;
if (var == -2) read_ac++;
if (var
<
0) goto stop;
var = WriteI2C(com);
if (var ==
0) read_s++;
if (var == -1) read_c++;
if (var == -2) read_ac++;
if (var
<
0) goto stop;
RestartI2C ();
// generates I2C bus restart condition
IdleI2C ();
var = WriteI2C(addr+1);
if (var ==
0) read_s++;
if (var == -1) read_c++;
if (var == -2) read_ac++;
if (var
<
0) goto stop;
Content = 0;
Content = ReadI2C ();
SSPCON2bits.ACKDT = 1;
// No master Acknowledge to terminate sequence
SSPCON2bits.ACKEN = 1;
// sending No Acknowledge bit
PIR1bits.SSPIF = 0;
while (SSPCON2bits.ACKEN == 1);
PIR1bits.SSPIF = 0;
// waiting till NA causes interrupt
stop:
StopI2C ();
CloseI2C ();
}
12.2 Operating the PS
Below is a small C-code for the main program to operate the proximity sensor of the SFH 7773.
The two subroutines, I2C_w_3 and I2C_w2_r1 are the same as above (see Sec. 12.1.2 and
12.1.3).
C-code for main program:
sfh_address = 0x38;
// address of SFH 7773
I2C_w_3 (sfh_address*2, 0x81, 0x03);
// initialize PS of the SFH 7773
I2C_w_3 (sfh_address*2, 0x82, 0x1E);
// set PS LED current to 200 mA
I2C_w_2_r_1 (sfh_address*2, 0x8F);
// read data byte of PS, register 0x8F
PS
=
Content;
12.3 Operating the ALS and PS in Interrupt Mode
The small C-code below operates the SFH 7773 in the interrupt mode. The ALS and PS are in
free-running mode. The interrupt event can occur through an ALS or PS event. The limits for
ALS (LB_LL, HB_LL, LB_HL, HB_HL) and PS (Prox_Limit) are set within the program.
After the interrupt has triggered the microcontroller the relevant sensor is determined and the
ALS or PS value is read out.
December 12, 2011
page 20 of 23



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23


Datasheet Download

Go To PDF Page


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


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
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