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.
3678.ISL290031.pdfHello Sir / Madam,
I am using MSP430F2618 for interfacing the sensor ISL290031 which has an I2C Interface. The sensor has some registers which i need to write as well as read to configure and use it. But it requires that i send the address of the register which is given and then data( indicated in the timing diagrams). How do I do it using MSP430? I examined the example codes given but they transmit only the data.
Awaiting Reply
Thank You
Hi Haresh,
the address of the registers is given in the data sheet. So, if you want to write to the COMMAND register - which address is 0x00 - you need to transmit three bytes via I2C:
Slave Address of your ISL290031 - 0x00 (since you want to write to the COMMAND register) - data to be written to the register.
Have a look at msp430x261x_uscib0_i2c_08.c - USCI_B0 I2C Master TX multiple bytes to MSP430 Slave --> find it in the MSP430F261x sample codes MSP430F241x, MSP430F261x
Rgds
aBUGSworstnightmare
I have two more doubts regarding this:
1> Do I have to send the slave address too? Because we store the slave address in UCB0I2CSA, and it is written in the MSP430 User guide that "The USCI module checks if the bus is available, generates the START condition, and transmits the slave address. The UCBxTXIFG bit is set when the START condition is generated and the first data to be transmitted can be written into UCBxTXBUF. As soon as the slave acknowledges the address the UCTXSTT bit is cleared" So i felt we shouldnt send the slave address,rather the MSP does it by itself.
2> In the master receive mode, as the code given in MSP430x261x_uscib0_i2c_10.c suggests we are not specifying from which location we are reading the value( i think it is because the slave in that program is another MSP430, am i right? ) , but in the case of the sensor ISL I would have to mention the address of the register. How do i do that?
Hi Haresh,
in case of only one I2C slave you don't need to change the contents of UCB0I2CSA (slave address), but since you can have multiple slaves on a bus it is a good advice to write (I2C-) routines which also handle the slave address.
The examples are for TX or RX only, so none of them is for RX/TX! They are just intended as a template for writing your own RX/TX routines (i.e. by combining them).
This app note http://focus.ti.com/mcu/docs/litabsmultiplefilelist.tsp?sectionId=96&tabId=1502&literatureNumber=slaa208a&docCategoryId=1&familyId=342 (interfacing EEPROM to MSP430 (USART or UCSI hardware) is maybe of good use for you too, since it shows how to access a certain address (memory location) on a I2C slave.
Rgds
aBUGSworstnightmare
Thanks a lot Sir :-) , the codes given in the above link were very helpful, i intended to do that way but was not sure.
**Attention** This is a public forum