// I also had these problems.
// I was searching for solutions in the datasheet, in the books, in the forums, familiar and unfamiliar .... is even.
// After months of anguish, ..."Eureka"
// - read once again battered pile of papers, I discovered "America",
//
// ...." Data valid: The state of the data line represents valid data when, after a START condition, the data
// line is stable for the duration of the HIGH period of the clock signal. The data on the line must be
// changed during the LOW period of the clock signal. There is one clock pulse per bit of data .".........
// And here is my "Newton solution":
void clock (void)
{
//=======================================================================
// for the time to add
//two line below:
//=======================================================================
while (PORTC.5 == 1) //this is "my" SDA = PORTC.5
{delay_us (1);}
//=======================================================================
i2c_start ();
i2c_read (0);
rtc_get_time (& RTC_Hour, & RTC_Mins, & RTC_Sec);
//=======================================================================
/ / And repeat the same thing for date
//=======================================================================
while (PORTC.5 == 1)
{delay_us (1);}
//=======================================================================
rtc_get_date (& RTC_Day, & RTC_Month, & RTC_Year);
i2c_stop ();
// .........................
}
// Enjoy. And do not suffer anymore.;D
// Please only say, "Thank you uncle Demuri.";D))
//
demuri@hotmail.com