hi all i am working with the eeprom 24c02 with msp430f6779 controller using the USCB1 I2C module .
I am able to write and read from eeprom but i am facing one problem that when i try to read more then one data with below function
unsigned char EEPROM_RandomRead(unsigned int Address)
{
unsigned char adr_hi;
unsigned char adr_lo;
while (UCB1STAT & UCBUSY); // wait until I2C module has
// finished all operations
adr_hi = Address >> 8; // calculate high byte
adr_lo = Address & 0xFF; // and low byte of address
I2CBufferArray[1] = adr_hi; // store single bytes that have to
I2CBufferArray[0] = adr_lo; // be sent in the I2CBuffer.
PtrTransmit = 1; // set I2CBufferArray Pointer
// Write Address first
I2CWriteInit();
UCB1CTLW0 |= UCTXSTT; // start condition generation
// => I2C communication is started
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupts
// Read Data byte
I2CReadInit();
UCB1CTLW0 |= UCTXSTT; // I2C start condition
//__bis_SR_register(LPM0_bits + GIE);
while(UCB1CTLW0 & UCTXSTT); // Start condition sent?
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupts
UCB1CTLW0 |= UCTXSTP; // I2C stop condition
while(UCB1CTLW0 & UCTXSTP); // Ensure stop condition got sent
return I2CBuffer;
}
above function give me the 2 same data if i read it from say address 0x0000 and 0x0001 it will give me data stored at address 0x0000 .