Reading temperature from the LSM303AGR.
I am initializing the 303 with the following code:
/* Turn on accelerometer */
WriteRegister(LSM303AGR_CTRL_REG1_A, LSM303AGR_ADDR_WRITE_A, 0x57);
x = ReadRegister(LSM303AGR_CTRL_REG1_A, LSM303AGR_ADDR_READ_A);
/* Turn on temp sensor and set BDU bit */
WriteRegister(LSM303AGR_TEMP_CFG_REG_A, LSM303AGR_ADDR_WRITE_A, 0xc0);
x = ReadRegister(LSM303AGR_TEMP_CFG_REG_A, LSM303AGR_ADDR_READ_A);
WriteRegister(LSM303AGR_CTRL_REG4_A, LSM303AGR_ADDR_WRITE_A, 0x80);
x = ReadRegister(LSM303AGR_CTRL_REG4_A, LSM303AGR_ADDR_READ_A);
In the mainline code I call the following:
t1 = Read16BitRegister(LSM303AGR_OUT_X_L_A, LSM303AGR_ADDR_READ_A);
where Read16Bit function reads 2 consecutive registers. I have also tried ReadRegister(LSM303AGR_REFERENCE_A, LSM303AGR_ADDR_READ_A);
where LSM303AGR_REFERENCE_A = 0x26h. No matter which way I do this the value(s) come back 0. I know these functions work because I can operate the part, acc, mag, all registers as per the datasheet. I just cannot get any data back from the temperature register.
Any help would be appreciated.
Thanks
