View previous topic :: View next topic |
Author |
Message |
Guest
|
Atmel's 24c256 eeprom |
Posted: Thu Sep 01, 2005 1:42 am |
|
|
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 ? |
|
![](templates/subSilver/images/spacer.gif) |
mbge5amw
Joined: 13 Dec 2004 Posts: 15 Location: Yorkshire, UK
|
Atmel's 24c256 eeprom |
Posted: Thu Sep 01, 2005 2:06 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Sep 01, 2005 6:10 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|