Simplified access to Microchip 24LCxx Serial EEPROM devices (I2C)
This library provides a simplified I2C access to a Microchip 24LCxx Serial
EEPROM device. This sample illustrates how to use this library and the schema
below shows the minimal implementation to run this sample. The I2C device
address is 0xA0 + 0x01, where:
- 0xA0 is the Microphip device address;
- 0x01 is the configurable address set by <A0:A2> (In the schema below, A0=1
and A2=A3=0).
Note that you have toprovide the configurable address to the C24LCxx_I2C class
constructor. The Microphip device address will be added automatically.

Note that if the LPC1768 is powered in 3.3V and the Microchip 24LCxx Serial
EEPROM device could be powered at 3.3V or 5V.
In this case, you shall use a bi-directional level shifter for I2C-bus. Please
refer to AN97055
(http://ics.nxp.com/support/documents/interface/pdf/an97055.pdf)
Microchip 24LCxx Serial EEPROM device reference:
- 24LC256: DS21203K
- 24LC64 : DS21189D
For I2C details, please visit http://www.datelec.fr/fiches/I2C.htm
Thanks a lot for your work on this.
Only one correction: The address is 0xA0 + 0x01 in the picture.
br
Hello Thomas,
You're right, thanks a lot for your remark, it's fixed now.
Br,
Yann
Hi,
in your sample you use a header-file. Where can I locate this?
br
Hello Thomas,
Sorry for the delay.
I use the following header files:
- #include "24LCxx_I2C.h"
- #include "EthernetNetIf.h"
- #include "NTPClient.h
The first is the 24LCxx_I2C header
The second is the header provided by the EthernetNetIf library.
The third is also provided by he EthernetNetIf library.
Best regards,
Yann
Hello Yann,
where can I find the 24LCxx_I2C.h - file? It is not part of the library.
br
Hi Thomas,
Sorry for the delay, I'm currently in Munich (snowing snowing...)!
It's strange, I've done an import in a new created project, after you edit the library (right click) and there are both header and code files.
Tell me if your problem persists, I'll send you an archive of the library.
Have a good day,
Yann
Dear Yann,
I had tried every time the link to the sample-programm above.
Now I take a look to yout Name and than the lib.
There the file is located.
Thanks
4 comments on Simplified access to Microchip 24LCxx Serial EEPROM devices (I2C):
Razu_Ahmmed
#
24 Feb 2013
Can you upload an sample code?
as far as i read from the datasheet that 8th bit is the mode select bit i.e. it will be written or read. How could you use this bit as address?
Dear Razu,
Please find sample application code here.
Don't hesitate to contact me if you got any problem.
Best Regards,
Yann
Hi Yan,
I've started to look at your code to see if I can use it to store some simple data between restarts (I'm planning on putting the code on an LPCxpresso board that doesn't have the mBed storage)
When I imported the library I found it also required your DebugLibrary, and after install that as well, I got the following error:
"no instance of constructor "mbed::I2C::I2C" matches the argument list" in file "24LCxx_I2C24LCxx_I2C.cpp", Line: 40, Col: 58
I also had a go at getting your example app to run as well, when importing the program I got the following error:
Unable to update the library to revision: /24LCxxI2CApp/24LCxxI2C
And when compiling the program I got about 30 Errors such as:
"name followed by "::" must be a class or namespace name" in file "/main.cpp", Line: 15, Col: 36
"incomplete type is not allowed" in file "/main.cpp", Line: 15, Col: 5
"expected a ")"" in file "/main.cpp", Line: 15, Col: 56
My C++ isn't great, so I found the app a bit impenetrable, do you have a simple HowTo covering how you read and write to/from one of these chips?
Many thanks,
Matt
Hi Yan, thanks for posting your code and dealing with the support issues!
I am getting the same error as above, namely
"no instance of constructor "mbed::I2C::I2C" matches the argument list" in file "24LCxx_I2C24LCxx_I2C.cpp", Line: 40, Col: 58"
and I am using the Debug library too.
this is using an NGX Technologies board with an AT24LC256 chip - but the compiler won't get as far as that yet....
#include "mbed.h"
#include "TextLCD.h"
#include "24LCxx_I2C.h"
TextLCD lcd(p23, p24, p25, p26, p29, p30, TextLCD::LCD16x2); //If using the NGX board.
//C24LCXX_I2C(const PinName p_sda, const PinName p_scl, const unsigned char p_address, const PinName p_wp = NC, const int p_frequency = 400000); C24LCXX_I2C(const PinName p_sda, const PinName p_scl, const unsigned char p_address, const PinName p_wp = NC, const int p_frequency = 400000);
C24LCXX_I2C mem(p13, p14, 00000100, NC , 400000);
DigitalOut myled(LED1);
std::string text2save("Hello World");
std::string readtext;
int main() {
lcd.cls();
lcd.locate(0,0);
lcd.printf("%s", text2save);
mem.Write(1, text2save, true, -1);//Write(const short p_address, const unsigned char *p_datas, bool p_storeLength = true, const int p_length2write = -1);
wait(0.2);
mem.Read(1, readtext);
lcd.locate(0,1);
lcd.printf("%s", readtext);
}
Please login to post comments.
Thanks a lot for your work on this.
Only one correction: The address is 0xA0 + 0x01 in the picture.
br