Data Sheet
35/40
Part No. : LTR-559ALS-01
BNS-OD-FC002/A4
Optical Sensor
LTR-559ALS-01
ALS Threshold Registers
// The ALS_THRES_UP and ALS_THRES_LOW registers determines the upper and lower limit of the interrupt threshold value.
// Following example illustrates the setting of the ALS threshold window of decimal values of 200 (lower threshold)
// and 1000 (upper threshold)
Slave_Addr = 0x23 // Slave address of LTR-559 device
// Upper Threshold Setting (decimal 1000)
ALS_Upp_Threshold_Reg_0 = 0x97 // ALS Upper Threshold Low Byte Register address
ALS_Upp_Threshold_Reg_1 = 0x98 // ALS Upper Threshold High Byte Register address
Data1 = 1000 >> 8 // To convert decimal 1000 into two eight bytes register values
Data0 = 1000 & 0xFF
WriteByte(Slave_Addr, ALS_Upp_Threshold_Reg_0, Data0)
WriteByte(Slave_Addr, ALS_Upp_Threshold_Reg_1, Data1)
// Lower Threshold Setting (decimal 200)
ALS_Low_Threshold_Reg_0 = 0x99 // ALS Lower Threshold Low Byte Register address
ALS_Low_Threshold_Reg_1 = 0x9A // ALS Lower Threshold High Byte Register address
Data1 = 200 >> 8 // To convert decimal 200 into two eight bytes register values
Data0 = 200 & 0xFF
WriteByte(Slave_Addr, ALS_Low_Threshold_Reg_0, Data0)
WriteByte(Slave_Addr, ALS_Low_Threshold_Reg_1, Data1)
PS Threshold Registers
// The PS_THRES_UP and PS_THRES_LOW registers determines the upper and lower limit of the interrupt threshold value.
// Following example illustrates the setting of the PS dynamic threshold with hysteresis interruption for
// decimal value 1000 (for NEAR detection) and 500 (for FAR detection)
Slave_Addr = 0x23 // Slave address of LTR-559 device
//For NEAR detection (decimal 1000)
PS_Upp_Threshold_Reg_0 = 0x90 // PS Upper Threshold Low Byte Register address
PS_Upp_Threshold_Reg_1 = 0x91 // PS Upper Threshold High Byte Register address
Data1 = 1000 >> 8 // To convert decimal 1000 into two eight bytes register values
Data0 = 1000 & 0xFF
WriteByte(Slave_Addr, PS_Upp_Threshold_Reg_0, Data0)
WriteByte(Slave_Addr, PS_Upp_Threshold_Reg_1, Data1)
PS_Low_Threshold_Reg_0 = 0x92 // PS Lower Threshold Low Byte Register address
PS_Low_Threshold_Reg_1 = 0x93 // PS Lower Threshold High Byte Register address
Data1 = 0 >> 8 // To convert decimal 0 into two eight bytes register values
Data0 = 0 & 0xFF
WriteByte(Slave_Addr, PS_Low_Threshold_Reg_0, Data0)
WriteByte(Slave_Addr, PS_Low_Threshold_Reg_1, Data1)
//For FAR detection (decimal 500)
PS_Upp_Threshold_Reg_0 = 0x90 // PS Upper Threshold Low Byte Register address
PS_Upp_Threshold_Reg_1 = 0x91 // PS Upper Threshold High Byte Register address
Data1 = 2047 >> 8 // To convert decimal 2047 into two eight bytes register values
Data0 = 2047 & 0xFF
WriteByte(Slave_Addr, PS_Upp_Threshold_Reg_0, Data0)
WriteByte(Slave_Addr, PS_Upp_Threshold_Reg_1, Data1)
PS_Low_Threshold_Reg_0 = 0x92 // PS Lower Threshold Low Byte Register address
PS_Low_Threshold_Reg_1 = 0x93 // PS Lower Threshold High Byte Register address
Data1 = 500 >> 8 // To convert decimal 500 into two eight bytes register values
Data0 = 500 & 0xFF
WriteByte(Slave_Addr, PS_Low_Threshold_Reg_0, Data0)
WriteByte(Slave_Addr, PS_Low_Threshold_Reg_1, Data1)