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.

tmp101

Other Parts Discussed in Thread: TMP101, MSP430F5418A

Hi, all

I'm using MSP430F5418A to get temperature from tmp101 by I2C. If I want to modify all the register(Configuration Register, TLOW Register, and THIGH Register), do I

have to restart the transfer after finishing configurating one of these registers?

Because by reading tmp101 datasheet, there is a sentence which is, the value for the Pointer Register is the first byte transferred after the I2C slave address byte

with the R/W bit LOW, so I think I have to restart the transfer process? Am I right?

Thx

Best regards

Nick

  • Hello Nick,

    Yes, each read/write to one of the TMP101 registers is considered one communication transaction, so to write to the Configuration register, TLOW register, and THIGH register you would need to do three consecutive register writes. Each write would follow the same format as shown below:

    1. Start condition by master
    2. Write TMP101 slave address (R/W bit LOW)
    3. ACK by TMP101
    4. Write to TMP101 pointer register (0x01 for Configuration, 0x02 for TLOW, or 0x03 for THIGH)
    5. ACK by TMP101
    6. Write data byte 1
    7. ACK by TMP101
    8. Write data byte 2 (TLOW or THIGH register only; Configuration register is only 1 byte)
    9. ACK by TMP101 (TLOW or THIGH register only; Configuration register is only 1 byte)
    10. Stop condition by master

    Best regards,

    Ian Williams
    Linear Applications Engineer 
    Precision Linear and Sensing Products 
  • Hi, Ian

    I really appreciate your help.

    Thx

    Best regards,

    Nick

  • Hi Ian,

    The process of writing to tmp101 is normal, but I encountered another question:

    when I read registers, first, I should tell tmp101 which register I want to read, so I have to write the value of pointer register to tmp101. Next, restart the process, after

    sending the slave address, tmp101 begin sending back the register value to the master. This is the read process which I got from datasheet. But how do I write my

    program following the process? After sending the value of pointer register, do I have to generate a stop? And how to switch to the receive data process?

    Thx

    Best regards,

    Nick

  • Hello Nick,

    This is the format for a register read. It’s similar to a register write, but a little more involved since you have to address the TMP101 twice – once with the R/W bit LOW when you’re writing to the pointer register, and once with the R/W bit HIGH when you’re actually doing the read. Don’t forget to generate another START condition after you’ve written to the pointer register and the TMP101 acknowledges (no STOP condition is needed before you generate this second START condition).

    1. Start condition by master 
    2. Write TMP101 slave address (R/W bit LOW) 
    3. ACK by TMP101 
    4. Write to TMP101 pointer register (whichever one you want to read) 
    5. ACK by TMP101 
    6. Start condition by master 
    7. Write TMP101 slave address (R/W bit HIGH) 
    8. ACK by TMP101 
    9. Read data byte 1 
    10. ACK by master 
    11. Read data byte 2 (if necessary) 
    12. ACK by master (if necessary) 
    13. Stop condition by master

    How you write your code to actually perform the reads and writes is dependent on which microcontroller/processor you're using and how it's configured, and is beyond the scope of this forum. If you're using an MSP430, there are plenty of code examples related to I2C which should be linked to the microcontroller's product page on the web site.

    Best regards,

    Ian Williams
    Linear Applications Engineer
    Precision Linear and Sensing Products