tsl2561cs Pacer Components, tsl2561cs Datasheet - Page 26

no-image

tsl2561cs

Manufacturer Part Number
tsl2561cs
Description
Light-to-digital Converter
Manufacturer
Pacer Components
Datasheet
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059L − JANUARY 2008
26
Copyright E 2008, TAOS Inc.
}
// scale if gain is NOT 16X
if (!iGain) chScale = chScale << 4;
// scale the channel values
channel0 = (ch0 * chScale) >> CH_SCALE;
channel1 = (ch1 * chScale) >> CH_SCALE;
//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
// find the ratio of the channel values (Channel1/Channel0)
// protect against divide by zero
unsigned long ratio1 = 0;
if (channel0 != 0) ratio1 = (channel1 << (RATIO_SCALE+1)) / channel0;
// round the ratio value
unsigned long ratio = (ratio1 + 1) >> 1;
// is ratio <= eachBreak ?
unsigned int b, m;
switch (iType)
{
case 0: // T package
case 1:// CS package
break;
if ((ratio >= 0) && (ratio <= K1T))
else if (ratio <= K2T)
else if (ratio <= K3T)
else if (ratio <= K4T)
else if (ratio <= K5T)
else if (ratio <= K6T)
else if (ratio <= K7T)
else if (ratio > K8T)
break;
if ((ratio >= 0) && (ratio <= K1C))
else if (ratio <= K2C)
else if (ratio <= K3C)
else if (ratio <= K4C)
else if (ratio <= K5C)
else if (ratio <= K6C)
else if (ratio <= K7C)
{b=B1T; m=M1T;}
{b=B2T; m=M2T;}
{b=B3T; m=M3T;}
{b=B4T; m=M4T;}
{b=B5T; m=M5T;}
{b=B6T; m=M6T;}
{b=B7T; m=M7T;}
{b=B8T; m=M8T;}
{b=B1C; m=M1C;}
{b=B2C; m=M2C;}
{b=B3C; m=M3C;}
{b=B4C; m=M4C;}
{b=B5C; m=M5C;}
{b=B6C; m=M6C;}
{b=B7C; m=M7C;}
r
www.taosinc.com
// scale 1X to 16X
r
The LUMENOLOGY r Company

Related parts for tsl2561cs