Hello All..
I need to create a program that write in I2C more than 16 Bytes....
But I have seen the example that write in a EPROM by I2C but it don't work for mor tah 16 BYTES.
Plz Some one can give to me a example how To use de FIFO to transmit more than 16 BYTES?
Uint16 I2CA_WriteData(struct I2CMSG *msg)
{
// Wait until the STP bit is cleared from any previous master communication.
// Clearing of this bit by the module is delayed until after the SCD bit is
// set. If this bit is not checked prior to initiating a new message, the
// I2C could get confused.
if (I2caRegs.I2CMDR.bit.STP == 1)
{
return I2C_STP_NOT_READY_ERROR;
}
// Setup slave address
// I2caRegs.I2CSAR = msg->SlaveAddress;
// Check if bus busy
if (I2caRegs.I2CSTR.bit.BB == 1)
{
return I2C_BUS_BUSY_ERROR;
}
// Setup number of bytes to send
// MsgBuffer + Address
I2caRegs.I2CCNT = 7;
// Setup data to send
// I2caRegs.I2CDXR = msg->MemoryHighAddr;
// I2caRegs.I2CDXR = msg->MemoryLowAddr;
// for (i=0; i<msg->NumOfBytes-2; i++)
I2caRegs.I2CDXR = 0x68;
I2caRegs.I2CDXR = 0x00;
I2caRegs.I2CDXR = 0x03;
I2caRegs.I2CDXR = 0x00;
I2caRegs.I2CDXR = 0x00;
I2caRegs.I2CDXR = 0x00;
I2caRegs.I2CDXR = 0xFF;
// Send start as master transmitter
I2caRegs.I2CMDR.all = 0x6E28;
return I2C_SUCCESS;
}