problem with wire and external eepron on Mega2560

First: I tried to use all the ways to send the addr and data to 24LC512 but nothing happened. The system recognize the addr (0x50 with A0, A1 and A2 tied to ground). Also, I tested the clock 100000 and 400000 khz.
The code is the standard:

Wire.beginTransmission(EEPROM_ADDR);
Wire.write(0x00);
Wire.write(0x20);
Wire.write(edata);
delay(10);
Wire.endTransmission();
delay(1);

Wire.beginTransmission(EEPROM_ADDR);
Wire.write(0x00);
Wire.write(0x20);
Wire.requestFrom(EEPROM_ADDR,1);
if(Wire.available())
{data=Wire.read();}
Wire.endTransmission();
Serial.print(data);
delay(1);

Second: what lib do you recomend me to use the DS3231 RTC.

Thanks.

MarceloJA:
First: I tried to use all the ways to send the addr and data to 24LC512 but nothing happened. The system recognize the addr (0x50 with A0, A1 and A2 tied to ground). Also, I tested the clock 100000 and 400000 khz.
The code is the standard:

Wire.beginTransmission(EEPROM_ADDR);

Wire.write(0x00);                        
 Wire.write(0x20);                        
 Wire.write(edata);
 delay(10);                                
 Wire.endTransmission();
 delay(1);

Wire.beginTransmission(EEPROM_ADDR);
 Wire.write(0x00);                        
 Wire.write(0x20);                        
 Wire.requestFrom(EEPROM_ADDR,1);
 if(Wire.available())
   {data=Wire.read();}
 Wire.endTransmission();
 Serial.print(data);
 delay(1);



Second: what lib do you recomend me to use the DS3231 RTC.

Thanks.

Your code is wrong:

// set EEPROM's internal address pointer to 0x0020
Wire.beginTransmission(EEPROM_ADDR);
Wire.write(0x0); // send high address byte
Wire.write(0x20); // send low address byte.
Write.endTransmission(); // this call actually does the I2C transmission, the prior calls just fill an internal buffer

// read 10bytes from EEPROM 0x0020 to 0x0029
uint8_t count =Wire.requestFrom(EEPROM_ADDR,10);
// count will be either 0 or 10, 0 if the EEPROM did not return and acknowledgment on the EEPROM_ADDR,
// else it will complete with 10
if(count==10){
  Serial.print(" successful read of eeprom: ");
  while (Wire.available()){
   uint8_t data=Wire.read();
   Serial.print(data,HEX);
   Serial.print(' ');
   }
 Serial.println();
 }
else {
  Serial.println(" bad stuff happened, the EEPROM did not acknowledge ");
  }

Try that code.

Chuck.