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 CCS Technical Support

Atmel's 24c256 eeprom

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








Atmel's 24c256 eeprom
PostPosted: Thu Sep 01, 2005 1:42 am     Reply with quote

Hi all,

I want to communicate with the atmels 24c256 eeprom and i dont think the compiler has a builtin driver for an I2C transmission. Would anybody have it?(i have only found one for ramtron, wd it be the one) If not i hope i can still access it with simple eeprom functions provided in the compiler, can i ?
mbge5amw



Joined: 13 Dec 2004
Posts: 15
Location: Yorkshire, UK

View user's profile Send private message MSN Messenger

Atmel's 24c256 eeprom
PostPosted: Thu Sep 01, 2005 2:06 am     Reply with quote

There is some example code for writing to a variety of different I2C EEPROM devices in the PICC\examples folder.
The files are 2401.c , 2402.c up to 24128.c
It ought to be relatively simple to modify the 128 byte version to work with your 256 byte device.

The compilers I use (PCM and PCH) both do have built in support for I2C, I believe this to be the case with the other compilers.

The use of the i2c functions is very simple with code such as this
Code:
i2c_start();
i2c_write(address);
data1 = i2c_read();
data2 = i2c_read();
i2c_stop();


the protocol for writing to and reading from your particular memory device should be explained in the data sheet for that device, I think they are all pretty much the same, just they may have different addresses, and some of the larger devices may need to be accessed with a different address depending on which bank of memory you wish to manipulate.


You cannot access an external eeprom with read_eeprom() or write_eeprom(), these are just for devices that have an internal eeprom.


Hope this helps

Andy
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Sep 01, 2005 6:10 am     Reply with quote

Grrr
Code:
///////////////////////////////////////////////////////////////////////////
////   Library for a 24LC256 serial EEPROM                             ////
////                                                                   ////
////   init_ext_eeprom();    Call before the other functions are used  ////
////                                                                   ////
////   write_ext_eeprom(a, d);  Write the byte d to the address a      ////
////                                                                   ////
////   d = read_ext_eeprom(a);   Read the byte d from the address a    ////
////                                                                   ////
////   The main program may define eeprom_sda                          ////
////   and eeprom_scl to override the defaults below.                  ////
////                                                                   ////
///////////////////////////////////////////////////////////////////////////

Since June of 2003!

Double Grrr
http://www.ccsinfo.com/forum/viewtopic.php?t=24099
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