This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMP411 ADR

Other Parts Discussed in Thread: TMP411

Hi

I am trying to use TMP411 with PIC18f25k83. If I try to read the configuration register (03H) or manufacturing ID register (0xFE) and initially the sensor responds with 1Ah but later on with FFh always. Is there any procedure for configuring the sensor in one shot mode and then read the temperature values. Please respond ASAP.

Thanks,

Ashin

  • Please find the code snippet below:
    i2c1_temp_read(TMP_411_SLAVE_ID, 0xFE); // Reads Manufacture ID
    i2c1_temp_read(TMP_411_SLAVE_ID, 0x03); // Reads Configuration Register

    uint8_t i2c1_temp_read(uint8_t address, uint8_t reg)
    {
    uint8_t result;
    I2C1_Initialize();
    I2C1ADB1= (uint8_t)(address<<1);
    I2C1CNT=2;
    I2C1CON0bits.RSEN=1;
    I2C1CON0bits.S=1; //Start
    sendByte(reg);
    wait4Ack();
    wait4MDRSetcount(1);
    address=(uint8_t)(address<<1);
    //__delay_ms(100);
    I2C1ADB1= (uint8_t)(address| 0x01); //Change the R/W bit for read
    I2C1CON0bits.S=1; //Start
    I2C1CON0bits.RSEN=0;
    result = receiveByte();
    wait4Stop();
    }
  • Hi Ashin,

    Could you share oscilloscope pictures of the failed communication?

    You'll need to always perform an I2C Write transaction with one byte to set the register pointer prior to performing an I2C Read transaction. For example, to read Device ID, you need to Start, Address+Write, ACK, 0xFF, ACK, Stop. Then Start, Address+Read, ACK, Read 8 bits, Stop. The result should be 0x12. If you read back 0xFF, it could mean that the device did not respond at all.

    Thanks,
    Ren