free 8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

Rickey's World :: Discussion Forums :: Discuss and Learn :: 8051 Discussion Forum
 
<< Previous thread | Next thread >>
problem with eeprom write.. plz help..... :(
Go to page       >>  
Moderators: Ajay Bhargav, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph, ExperimenterUK, DavesGarage
Author Post
tweety bird
Mon Jul 06 2009, 11:24AM
 User Offline
Registered Member #7329
Joined: Sat Apr 19 2008, 08:49PM

Posts: 70
Thanked 8 times in 7 posts
i have been working on eeprom interfacing since last few days...
i successfully ran my project on proteus.... the eeprom read n write works fine....

but when i burnt my at89s52, the program didnt run on it as thought of... the eeprom write encounters some problems i dont know wat, but on reading back eeprom i get only garbage characters on lcd screen...
the problem seems to come after write data byte to eeprom, i dont seem to get ack from eeprom...
void mem_write(unsigned char value)
{
char j;
bitchar=value;
for(j=0;j<8;j++)
{
scl=0; // to clock in data
sda=msbc;
scl=1;
bitchar=bitchar<<1;
}
scl=0; // to receive ack from eeprom
scl=1;
scl=0;
delay(3);

}

the above code works fine in proteus but not in real project... i use pagewrite to write to eeprom.... plz help

Back to top

DavesGarage
Mon Jul 06 2009, 08:51PM

 User Offline
Registered Member #14254
Joined: Tue Jan 20 2009, 08:14AM

Posts: 621
Thanked 116 times in 112 posts
What part are you trying to write to? What is the part number - a link to the data sheet would also be helpful.


-Dave
"Basic research is what I am doing when I don't know what I am doing"
Back to top


This post has been thanked 1 time
tweety bird
Tue Jul 07 2009, 12:52AM
 User Offline
Registered Member #7329
Joined: Sat Apr 19 2008, 08:49PM

Posts: 70
Thanked 8 times in 7 posts
oops.. i have been trying to write to 24c16 atmel eeprom....
first i send dev adress = 0xA0, them mmry word address = 0x00 ... then 16byte page write seq ...
start
devadd(0xa0)
memadd(0x00)
for(i=0;i<16;i++)mem_write(arr[i]);
stop
Back to top

tweety bird
Tue Jul 07 2009, 10:46AM
 User Offline
Registered Member #7329
Joined: Sat Apr 19 2008, 08:49PM

Posts: 70
Thanked 8 times in 7 posts
????????????????????
Back to top

DavesGarage
Tue Jul 07 2009, 11:16AM

 User Offline
Registered Member #14254
Joined: Tue Jan 20 2009, 08:14AM

Posts: 621
Thanked 116 times in 112 posts
Is this your memory device?

http://atmel.com/dyn/products/product_card.asp?part_id=3513

???


-Dave
"Basic research is what I am doing when I don't know what I am doing"
Back to top

DavesGarage
Tue Jul 07 2009, 11:22AM

 User Offline
Registered Member #14254
Joined: Tue Jan 20 2009, 08:14AM

Posts: 621
Thanked 116 times in 112 posts
Also, is this how you have it connected?





Remember, for someone to help, they must first understand what you are doing. Without a part description, and a schematic, it is very difficult to write software...



Please try and be specific when asking for help...



-Dave
"Basic research is what I am doing when I don't know what I am doing"
Back to top

tweety bird
Tue Jul 07 2009, 11:33AM
 User Offline
Registered Member #7329
Joined: Sat Apr 19 2008, 08:49PM

Posts: 70
Thanked 8 times in 7 posts
ya dat is the eeprom .. n dat is how i have connected it ..


Back to top

tweety bird
Tue Jul 07 2009, 11:38AM
 User Offline
Registered Member #7329
Joined: Sat Apr 19 2008, 08:49PM

Posts: 70
Thanked 8 times in 7 posts
void mem_datawr() // starts the sequence of writing data to eeprom
{
char i;
rstart();
mem_write(dev_addw); // load dev_add into eeprom
mem_write(mem_addw);
for(i=0;i<16;i++,mem_addw++)
{mem_write(arr[arr_count++]); // writes contents of arr[16] to eeprom using pagewrite
if(sda!=0){led=0; delay(20); led=1; delay(20); }
}
stop();
delay(3);
}


above function is used to write data to eeprom .. in proteus simulator , it works perfectly... but not in my real project .. dont know y...
in my real prog, led keeps on blinkin indicating of not receiving proper ack... ((
Back to top

DavesGarage
Tue Jul 07 2009, 11:47AM

 User Offline
Registered Member #14254
Joined: Tue Jan 20 2009, 08:14AM

Posts: 621
Thanked 116 times in 112 posts
Next, how fast are you talking to the device? Have you measured your data stream with an o-scope?

The part has a maximum frequency of 400kHz...

Are you within this boundary?


-Dave
"Basic research is what I am doing when I don't know what I am doing"
Back to top

Ajay Bhargav
Wed Jul 08 2009, 05:35AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 7542
Thanked 1330 times in 1254 posts
just make sure your memory is not busy in writing data to EEPROM.

give sufficient delay after writing, normally 5ms or more. try 1 byte at a time to test.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top

Go to page       >>   

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems