Hi,
I am really want some help in understanding I2C interfacing.
I am using accelerometer which has its device address 0x31(7-bits) and the control register address is 0x20 which is r/w register and i want to write data 0x65 to this register and to check whether this data is written i want to read the same register so i have to receive the same data which is 0x65.
The MCU is MSP430FR5739 exp board.
The question here is which order i have to follow for the above said description ?
Here master is the MSP430 and slave is the accelerometer.
i have set UCB0I2COA0 =0x31; and to read and write the control register do i need to set again UCB0I2COA0 =0x20 ?
MASTER_TX(0x31); (where this will set UCB0I2COA0 =0x31)
MASTER_TX(0x02); (where this will set UCB0I2COA0 =0x20)
MASTER_TX(0x65); (where this will set UCB0I2COA0 =0x31 and Tx_buffer = 0x65)
SLAVE_RX();
SLAVE_TX();
MASTER_RX();
is this order is correct ? and i am following device example codes but not working.
i am calling all these function under the same program.
Please help me..
Regards.