Data Sheet

34/40
Optical Sensor
LTR-559ALS-01
ALS / PS Status Register (Read only)
// The ALS_PS_STATUS Register contains the information on Interrupt, ALS and PS data availability status.
// This register is read only.
Slave_Addr = 0x23 // Slave address of LTR-559 device
// Read back Register
Register_Addr = 0x8C // ALS_PS_STATUS register address
ReadByte(Slave_Addr, Register_Addr, Data)
Interrupt_Status = Data & 0x0A // Interrupt_Status = 8(decimal) ALS Interrupt
// Interrupt_Status = 2(decimal) PS Interrupt
// Interrupt_Status = 10(decimal) Both Interrupt
NewData_Status = Data & 0x05 // NewData_Status = 4(decimal) ALS New Data
// NewData_Status = 1(decimal) PS New Data
// NewData_Status = 5(decimal) Both 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
PS Data Registers (Read only)
// The PS Data Registers contain the ADC output data.
// These registers should be read as a group, with the lower address being read first.
Slave_Addr = 0x23 // Slave address of LTR-559 device
// Read back PS_DATA registers
Register_Addr = 0x8D // PS_DATA low byte address
ReadByte(Slave_Addr, Register_Addr, Data0)
Register_Addr = 0x8E // PS_DATA high byte address
ReadByte(Slave_Addr, Register_Addr, Data1)
PS_ADC_Data = (Data1 << 8) | Data0 // Combining lower and upper bytes to give 16-bit PS 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 = 0x23 // Slave address of LTR-559 device
// Set Interrupt Polarity for Active Low, both ALS and PS trigger
Register_Addr = 0x8F // Interrupt Register address
Command = 0x03 // Interrupt is Active Low and both ALS and PS can trigger
// For Active High Interrupt, both trigger, Command = 0x07
// For Active High Interrupt, ONLY ALS trigger, Command = 0x06
// For Active High Interrupt, ONLY PS trigger, Command = 0x05
WriteByte(Slave_Addr, Register_Addr, Command)