CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Error in 24512.c driver

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Neckruin



Joined: 17 Jan 2006
Posts: 66

View user's profile Send private message

Error in 24512.c driver
PostPosted: Tue Dec 12, 2006 7:19 am     Reply with quote

Hi all,
I've been trying to use the 24512.c driver with a 24LC512 serial EEPROM from MicroChip and I have detected a problem.
When doing more than one single byte write into the memory, only the first byte was correctly written. I have modified the code of the write_ext_eeprom() function and now it works.
This is the new code for that function:
Code:
void write_ext_eeprom(int16 address, int8 data) {
   int1 status;
   int8 add1;
   int8 add2;
   
   add1 = make8(address, 1);
   add2 = make8(address, 0);
   i2c_start();
   i2c_write(EEPROM_WRITE);
   i2c_write(add1);
   i2c_write(add2);
   i2c_write(data);
   i2c_stop();
   i2c_start();
   status=i2c_write(EEPROM_WRITE);
   while(status==1)
   {
      i2c_start();
      status=i2c_write(EEPROM_WRITE);
   }
   i2c_stop(); // I added this line
}


See you all,

Juanma
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group