how to make 24hour formate to 12hours format in DS3017 RTC chip i am using the RTC lib downloaded fro website``
RTClibmaster.zip (9.54 KB)
how to make 24hour formate to 12hours format in DS3017 RTC chip i am using the RTC lib downloaded fro website``
RTClibmaster.zip (9.54 KB)
Which library, if any, are you using?
The DS1307 can be run in either 12-hour or 24-hour mode. Bit 6 of the hours register is defined as the 12-hour 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 to 23 hours). The hours value must be re-entered whenever the 12/24-hour mode bit is changed.
I don't download zip files from public forums.
Could you provide a link to where you got it from?
For 24hr to 12hr conversion you could try this:
byte hourNow;
if (now.hour > 12 )
{
hourNow = now.hour - 12;
}
else
{
hourNow = now.hour;
}
I'm also assuming that you mean the 1307 RTC as I'm not aware of a 3017? And nor is Google!
I can't see anything in there that looks like it will cope with 12/24 hour display so it looks like you're going to have to talk to the chip directly, without library.
Unless someone else knows of a suitable library.