lampje68:
thanks so far for the quick reply, my problem is that i can't get the stored data in address 1 to 11 ( that's all ),back into my program ( which by the way is not yet finished.
the external eeprom i'm using is intergrated in a real time module ( rtc1307)
The EEPROM of the RTC1307 Module is: ATMEGA 24C32 with device address 0b1010000 (0x50) and capacity 4 Kbyte.
1. Assume that your data are:
byte myData[] = {0x12, 0x24, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9A, 0xAB, 0xBC, 0xCD};
2. Assume that Target EEPROM locations are:
0x0001 to 0x000B (1 to 11)
3. The following sketch performs Read-after-Write verification of data in the EEPROM. The read out data are in the array recData[]. Now, you can use them in your program as needed.
#include<Wire.h>
byte myData[] = {0x12, 0x24, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9A, 0xAB, 0xBC, 0xCD};
int eepromAddress = 0x0001;
byte recData[11];
void setup()
{
Serial.begin(9600);
Wire.begin();
Wire.beginTransmission(0x50);
Wire.write(highByte(eepromAddress)); //pointing beginning address of EEPROM
Wire.write(lowByte(eepromAddress));
Wire.write(myData, sizeof(myData));
byte busStatus = Wire.endTransmission();
if(busStatus !=0)
{
Serial.print("EEPROM not found...!");
while(1);
}
delay(5); //write cycle delay
//-------------------------------------------
Wire.beginTransmission(0x50);
Wire.write(highByte(eepromAddress)); //pointing beginning address of EEPROM
Wire.write(lowByte(eepromAddress));
Wire.endTransmission();
//--------------------------------------------
byte n = Wire.requestFrom(0x50, 11); //reading 11 bytes data
for (int i = 0; i < n; i++)
{
recData[i] = Wire.read();
Serial.print(recData[i], HEX);
Serial.print(' ');
}
}
void loop()
{
}

