- This topic has 0 replies, 1 voice, and was last updated 9 years ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
|
Microcontroller › PIC › Reg-EEPROM
Hai everyone,
I have some doubt in the following program
* In both read and write mode why we are using I2CSend(0x00); I2CSend(0x00);
* In read mode why we are using I2CAck(); I2CNak();.In I2c Ack has been automatically generated by slave then why should we are giving Ack and Nak
////////////////EEPROM READ and WRITE\\\\\\\\
I2CInit();
I2CStart();
I2CSend(0xA0);
I2CSend(0x00);
I2CSend(0x00);
for(j=0;j<6;j++)
{
I2CSend(I2CData[j]);
}
I2CStop();
__delay_ms(100);
I2CStart();
I2CSend(0xA0);
I2CSend(0x00);
I2CSend(0x00);
I2CRestart();
I2CSend(0xA1);
for(j=0;j<6;j++)
{
rcdata[ j]= I2CRead();
I2CAck();
}
if ( i – 1)
I2CAck();
else
I2CNak();
I2CStop();
LCD_OUT(2,7,rcdata);
while(1);
}