DS3017 RTC

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.

thomasmv: i have downloaded a sketch which is a 2 seven segment display and 2 shifregisters (74HC595) which will count from 0 to 99 and it repeats i want to add a pot meter 10K to A0 pin so that the counter should count from 0 to 99 when i turn the pot from start to end (0-180 Digree) i am posting my sketch so some one can help me

Wow, this thread took a hell of a turn. Weren't we already working on this problem on another thread?