p89v51rd2 i2c slave not give ack

Status
Not open for further replies.

cheenu02

Junior Member level 3
Joined
Jun 16, 2011
Messages
31
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,500
hi,
i am new to i2c.I want to send data to EEPROM (m24c08).I am not getting correct output.My output is like this S A0 N 0F N 31 N P.I didn't get ack signal from slave.help me

MY CODE IS

void main()
{
start();
write_data(0xa0);
write_data(0x0f);
write_data(0x31);
stop();
}
void write_data(unsigned char d)
{

unsigned char i;
scl=0;
for(i=0;i<8;i++)
{
scl=0;
if(d & 0x80)
sda=1;
else
sda=0;

scl=1;
d=d<<1;

}
scl=0;
sda=1;

scl=1;

}
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…