for (u8Count = 0; u8Count <PAGE_SIZE; u8Count++)
{
set_AA; /* Set Assert Acknowledge Control Bit */
clr_SI;
while (!SI);
if (I2STAT != 0x50) /* 0x50:Data byte has been received; NOT ACK has been returned */
{
I2C_Reset_Flag = 1;
printf("\nI2C 'No Ack' error");
goto Read_Error_Stop;
}
if (I2DAT != u8DAT) /* Send the Data to EEPROM */
{
I2C_Reset_Flag = 1;
printf("\nI2C 'Read data' error");
goto Read_Error_Stop;
}
u8DAT = ~u8DAT;
} |