Hi Friends, I'm using a real time clock chip (DS1307) which has back up battery when power goes out. My problem is the chip doesn't keep up time when on B/U power, it just stops there. When power is back on, it keep time from there OK. Problem is power is not always on, but I need accurate time stamps. Chip communicates via I2C serial. Just wondering if there is any line of code I have to add to initialize the chip start up...
_______________
Quote from Data sheet:
CLOCK AND CALENDAR
The time and calendar information is obtained by reading the appropriate register bytes. The RTC
registers are illustrated in Figure 3. The time and calendar are set or initialized by writing the appropriate
register bytes. The contents of the time and calendar registers are in the BCD format. Bit 7 of register 0
is the clock halt (CH) bit. When this bit is set to a 1, the oscillator is disabled. When cleared to a 0, the
oscillator is enabled.
Please note that the initial power-on state of all registers is not defined. Therefore, it is important
to enable the oscillator (CH bit = 0) during initial configuration.
The DS1307 can be run in either 12-hour or 24-hour mode. Bit 6 of the hours register is defined as the
12- or 24-hour mode select bit. When high, the 12-hour mode is selected. In the 12-hour mode, bit 5 is
the AM/PM bit with logic high being PM. In the 24-hour mode, bit 5 is the second 10 hour bit (20-
23 hours).
_____________________
DS1307 PDF Datasheet