I connect Arduino with EEPROM AT24c01
program can write and read data at address 0x50. but if the address is converted into a 0x57 storage and pin connection A0, A1, A2 on removable AT24c01 (rated 1) when the process of reading data at address 0x57 is data that appears in the address 0x50.
I have replaced it with a new AT89c024 but the results remain the same.
please help me. sorry my bad english
#include <Wire.h>
byte alamat ;
//program write eeprom ;
byte dataku[16]={'A','B','C','D','E','F','A','B','Z','Z','Z','Z','Z','Z','Z','Z'};
void setup()
{
Wire.begin();
Serial.begin(115200);
add = 0x50;
}
void loop()
{
Serial.println("Write EEPROM");
for(int i = 0; i < 16; i++)
{
Wire.beginTransmission(add);
Wire.send(i);
Wire.send(dataku[i]);
Wire.endTransmission();
delay(100);
}
Serial.println("end");
delay(60000);
}
// program read eeprom
#include <Wire.h>
byte add ;
byte r ;
void setup()
{
Wire.begin();
Serial.begin(115200);
}
void loop()
{
Serial.println("Read data");
for(int i = 0; i < 16; i++)
{
Wire.beginTransmission(0x50);
Wire.send(i);
Wire.endTransmission();
Wire.requestFrom(0x50,1);
r = Wire.receive();
Serial.print(i);
Serial.print(" - ");
Serial.print(r,BYTE);
Serial.print("\n");
delay(200);
}
Serial.println("end");
delay(3000);
}