Other Parts Discussed in Thread: TMP102
I've been playing around with my Launchpad and a Tmp102 sensor, trying to use the sensor controller to retrieve some temperatures and then send them through BLE, however I noticed that I have to multiply the I2C addresses for the Tmp102 by 2 in order for the connection to work. So, instead of trying to talk to address 0x48, I have to talk to 0x90. Am I doing something wrong in my I2C code?
Any help would be very appreciated.
InitCode:
// Configuracion inicial del TMP102
U16 i2cAddress;
for (U16 n = 0; n < 4; n++) {
if (n == 0) {
i2cAddress = TMP1_I2C_ADDR*2;
} else if (n == 1) {
i2cAddress = TMP2_I2C_ADDR*2;
} else if (n == 2) {
i2cAddress = TMP3_I2C_ADDR*2;
} else if (n == 3) {
i2cAddress = TMP4_I2C_ADDR*2;
} else {
i2cAddress = 0;
}
i2cStart();
i2cTx(I2C_OP_WRITE | i2cAddress);
i2cTx(TMP_REG_CFG);
i2cTx(0x79);
i2cTx(0x20);
i2cStop();
i2cStart();
i2cTx(I2C_OP_WRITE | i2cAddress);
i2cTx(TMP_REG_TMPH);
i2cTx(0x28);
i2cTx(0x00);
i2cStop();
i2cStart();
i2cTx(I2C_OP_WRITE | i2cAddress);
i2cTx(TMP_REG_TMPL);
i2cTx(0x26);
i2cTx(0x00);
i2cStop();
}
// Comienza la primer ejecucion
fwScheduleTask(1);