GolamMostafa:
Finally, you have posted your codes. This is fine. Before you proceed to store data into your 24C16 EEPROM, the 8-pins of the chip must be terminated properly. Can you post the connection diagram of your memory, which will show the connections of the following signals of the chip.Vcc
GNDPB0
PB1Mode
PRE
SDA
SCLAssuming that you have read the data sheets, and you have correctly terminated the signal/power lines of the memory chip.
Let us try to write 0x23 in the location 0x0010 of the Block-0 of the memory chip. You know that there are 8 blocks in the 24C16 chip, and each block is composed of 256 locations. The address of the Block-0 space is: 0x50.
Untested Codes:
#include<Wire.h>
void setup()
{
Serial.begin(9600);
Wire.begin();
Wire.beginTransmission(0x50);
Wire.write(0x00);
Wire.write(0x10);
Wire.write(0x23);
Wire.endTransmission();
delay(10);
//read back data and show on Serial Monitor
Wire.beginTransmission(0x50);
Wire.write(0x00);
Wire.write(0x10);
Wire.endTransmission();
Wire.requestFrom(0x50, 1);
byte x = Wire.read();
Serial.print(x, HEX); //should show: 23
}
void loop()
{
}
its the code for write one byte on eeprom . i want write 4 byte in eeprom with wire.h . thanks