MD_DS1307 Time Setting Problem !

Hi,

I am writing a code for clock everything is working fine for me except AM and PM settings , please share any example of code that how can i forcefully send AM or PM settings to clock !

Thanks !

Run it in 24 hour mode, read AM & PM bit that way.
Hours will run from 0 to 23, 00:00:00 to 11:59:59 is AM, 12:00:00 to 23:59:59 is PM.

I used a lookup array to convert the 24 hours to 12 hours:
12,1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11

CrossRoads:
Run it in 24 hour mode, read AM & PM bit that way.
Hours will run from 0 to 23, 00:00:00 to 11:59:59 is AM, 12:00:00 to 23:59:59 is PM.

I used a lookup array to convert the 24 hours to 12 hours:
12,1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11

Any little code example for this approach ? Please share

or is there any way to adjust PM and AM setting in 12_hr mode only !

Read the data sheet and write the correct bits.

Or, use whatever library you are using to do the same.

Or, you can try my library that has methods to allow you to do this (link in my signature block).

marco_c:
Read the data sheet and write the correct bits.

Or, use whatever library you are using to do the same.

Or, you can try my library that has methods to allow you to do this (link in my signature block).

I am already using MD_ds1307 library (written by you), RTC.pm returns (0 or 32) but can i send RTc.pm a value of AM and PM again ?
if yes then how ?

Thanks !

I am already using MD_ds1307 library

In that case you use the RTC.control() method to set 24 hour mode on or off.

Also, please make sure you are running the latest version of the library as there was an AM/PM bug that was fixed earlier this year

  v1.2 April 2016
  - Fixed bug in setting the time when in 12 hour mode.

Got A way to do it , changed my approach and got it fixed ,

Added some of my custom functions in MD_DS1307 library !

Thx

OK, although it is strange to me that you worked out enough to modify it without seeing how it works in the first place.

Please mark the topic as solved.