Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

EEPROM i2c problem! Lack of AKC after data

Status
Not open for further replies.

milem

Newbie level 6
Joined
Mar 11, 2008
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,382
EEPROM i2c problem!

I need help with i2c EEPROM!

I built code to write and read from I2c EEPROM conected to 89s52 (at 24MHz)
but i have problem!

when i send first byte of device adress i get ACK from memory, but when
i send memory byte (start of memory) i don't get ACK, what is the problem!

P.S. Simulation in Keil and Protheus report that code is working!
 

Re: EEPROM i2c problem!

the problem maybe adding more delay? or maybe the speed of your eeprom memory do not match (100khz or 400khz?)

posting your code here make things clearer..
 

Re: EEPROM i2c problem!

My code is :

Code:
void send (void)
{
TR1=1;
	i2sda=i2scl=1;NOP;	 	// Signali starta
	i2sda=0;NOP;i2scl=0;	//
	k=0;
	TR1=1;
	i=0;
	send_byte(0xA0);	//Slanje adrese
	NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
	if(i2sda==0) {write_string("1100");}
	else {write_string("1000");return;}
	i=0;
	send_byte(0x01);
	NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
	if(i2sda==0) {write_string("2100");}
	else {write_string("2000");return;}
			
	i=0;
	send_byte(p[0]);
	NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
	if(i2sda==0) {write_string("3100");}
	else {write_string("3000");return;}
	i=0;						 
	send_byte(p[1]);
	NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
	if(i2sda==0) {write_string("4100");}
	else {write_string("4000");return;}
	i=0;
	send_byte(p[2]);
	NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
	if(i2sda==0) {write_string("5100");}
	else {write_string("5000");return;}
	i=0;
	send_byte(p[3]);
	NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
	if(i2sda==0) {write_string("6100");}
	else {write_string("6000");return;}
	i=0;
	while(i2scl==1) {;} i2sda=0;
	while(i2scl==0) {;} i2sda=1; 
	
	TR1=0;
	i2sda=i2scl=1;
}

I using Timer1 for generating SCL impulses! Maybe is that problem, but if EEPROM
respond to adress, i mean thats Ok!

Timer1 overload function!
Code:
void Tajmer1(void) interrupt 3
{
TH1=0xF0;TL1=0x00;
	if(k==0) 
	{
		i2scl=1;	
	}
	else
	{
		i2scl=0;
	}
	k=~k;i++;
}
[/code]
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top