Hi Team,
Customer used LMP91000 to do a project to measure gas concentration. He downloaded the code based on MSP430 microcontroller on the Internet. Set LMP91000 at the beginning of the program, the command was 0X48. 0X48 was the address of 91000. The customer wanted to know whether to write the address directly, can read data from 01--12 without writing any command? Then writed 0X00 and 0X18? Customer was unable to understand this well.
I2CSetup(LMP91000_I2C_Address); (0X48) // Initialize I2C modul
TI_LMP91000_MENB_PxOUT &= ~TI_LMP91000_MENB_PIN; // Enable \MENB Pin
TI_LMP91000_MENB_PxDIR |= TI_LMP91000_MENB_PIN; // Set pin direction is outpu
while (status == TI_LMP91000_NOT_READY) (0X00) // wait while device is not ready
status = LMP91000_I2CReadReg(TI_LMP91000_STATUS_REG); (0X00) // Read device ready status
read_val[0] = LMP91000_I2CReadReg(TI_LMP91000_LOCK_REG); (0X01) // Read from lock register default value
read_val[1] = LMP91000_I2CReadReg(TI_LMP91000_TIACN_REG); (0X10) // Read TIA control register default value
read_val[2] = LMP91000_I2CReadReg(TI_LMP91000_REFCN_REG); (0X11) // Read Reference control register default value
read_val[3] = LMP91000_I2CReadReg(TI_LMP91000_MODECN_REG); (0X12) // Read Mode control register default value
(0X01) (0X00)
LMP91000_I2CWriteReg(TI_LMP91000_LOCK_REG, TI_LMP91000_WRITE_UNLOCK); // unlock the registers for write
(0X10) (0X18)
LMP91000_I2CWriteReg(TI_LMP91000_TIACN_REG, TIACN_NEW_VALUE); // Modify TIA control register
read_val[1] = LMP91000_I2CReadReg(TI_LMP91000_TIACN_REG); // Read to confirm register is modified
(0X10)
// test if write/read values match
if (read_val[1] == TIACN_NEW_VALUE) (0X18)
{
while (1) // no error: blink LED continuously
{
__delay_cycles(250000);
__delay_cycles(250000);
TI_LMP91000_LED_PxOUT ^= TI_LMP91000_LED_PIN;
}
} else
{
TI_LMP91000_LED_PxOUT &= ~TI_LMP91000_LED_PIN; // error: Set LED OFF
}
(0X10) (0X03)
LMP91000_I2CWriteReg(TI_LMP91000_TIACN_REG, TI_LMP91000_TIACN_REG_VALUE); // store default value back in TIACN
(0X01) (0X00)
LMP91000_I2CWriteReg(TI_LMP91000_LOCK_REG, TI_LMP91000_WRITE_LOCK); // lock the registers
TI_LMP91000_MENB_PxOUT |= TI_LMP91000_MENB_PIN; // Disable \MENB Pin
Best Regards,
Annie