Re: RTC ds1307
Hi,
It is easy as follows:
In 12 hour mode to set 9 PM, load register 02 with 0X 69 . This will set D6 bit hi (12 hour mode) and D5 bit hi (PM) and Do to D3 will give number 9. In this mode:
- to set 10 PM , you load reg.2 with 0X 70 (D4=1 for hour ten) and
- to set 12 PM, load reg.2 with 0X 72 and so on. Similarly,
- to set 9 AM , you load reg 2 with 0X 49
- to set 10 AM , load 0X 50
- to set 12 AM, load 0X 52
In 24 hour mode to load 21 hours, reg.2 is to be loaded with 0X 21 (Bit D6 = 0 and D5 = 1 for hour 2 in BCD)
- to set 10 hours in 24 hr mode load 0X 10
- to set 9 hours in 24 hour mode load 0X 09
- to set 12 hours in 24 hour mode load 0X 12
- to set 23 hours in 24 hour mode load 0X 23 and so on.
Minutes and Seconds registers do not change with mode change.
I hope it is clear now.
Regards,
Laktronics