ALS Status Register (Read only)
// The ALS_STATUS Register contains the information on ALS data availability status. This register is read only.
Slave_Addr = 0x29 // Slave address of LTR-303 device
// Read back Register
Register_Addr = 0x8C // ALS_STATUS register address
ReadByte(Slave_Addr, Register_Addr, Data)
Interrupt_Status = Data & 0x08 // Interrupt_Status = 8(decimal) ALS Interrupt
NewData_Status = Data & 0x04 // NewData_Status = 4(decimal) ALS New Data
ALS_Data_Valid = Data & 0x80 // ALS_Data_Valid = 0x00 ALS New Data is valid (usable)
// ALS_Data_Valid = 0x80 ALS New Data is invalid, discard and wait for
new ALS data
Interrupt Registers
// The Interrupt register controls the operation of the interrupt pins and function.
// The default value for this register is 0x08 (Interrupt inactive)
// Note that when this register is to be set with values other than its default values,
// it should be set before device is in active mode.
Slave_Addr = 0x29 // Slave address of LTR-303 device
// Set Interrupt Polarity for ALS Active Low trigger
Register_Addr = 0x8F // Interrupt Register address
Command = 0x0A // Interrupt is Active Low ALS trigger
// For Active High Interrupt ALS trigger, Command = 0x0E
WriteByte(Slave_Addr, Register_Addr, Command)
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 = 0x29 // Slave address of LTR-303 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)
WriteByte(Slave_Addr, ALS_Upp_Threshold_Reg_1, Data1)