- DS1307_TimeRegs_t CurrentRTCTime;
- CurrentRTCTime.Byte1.TenSec = (Second / 10);
- CurrentRTCTime.Byte1.Sec = (Second % 10);
- CurrentRTCTime.Byte1.CH = false;
- CurrentRTCTime.Byte2.TenMin = (Minute / 10);
- CurrentRTCTime.Byte2.Min = (Minute % 10);
- CurrentRTCTime.Byte3.TenHour = (Hour / 10);
- CurrentRTCTime.Byte3.Hour = (Hour % 10);
- CurrentRTCTime.Byte3.TwelveHourMode = false;
-
- if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
- {
- TWI_SendByte(DS1307_TIMEREG_START);
- TWI_SendByte(CurrentRTCTime.Byte1.IntVal);
- TWI_SendByte(CurrentRTCTime.Byte2.IntVal);
- TWI_SendByte(CurrentRTCTime.Byte3.IntVal);
-
- TWI_StopTransmission();
- }