Auto set of DS1307 date/time

MearCat

Member
I'm working with a DS1307 real time clock and each time I change my program, I have to change the date & time values in the writei2c command to set the current time. It's starting to annoy me having to do this repeatedly. I will eventually get a 3V backup battery & holder to connect to the DS1307 so it doesn't lose it's time when I remove power, but until then...

Is there any way I can use a program to set the date & time automatically in the DS1307. ie : get the values of the PC's clock and write them to variables and then to the DS1307?

-Alan
 

hippy

Technical Support
Staff member
Yes, but to be honest, the time it would take to explain how or write the code for both PC and PICAXE and the aggravation of getting it to work everytime you re-power your PICAXE it would be far easier to just get a 3V battery. You'll probably find two AA's in a standard battery box will work. If it's a three battery holding box just link across the unused slot with a wire.

For Real Man (TM) DIY, two batteries in rolled up paper with wires wrapped round drawing pins all held together with elastic bands and sticky tape should do the job.

Now where's my Blue Peter badge ... ?
 

MearCat

Member
HAHA - I choose the Real Man (TM) DIY option!!

I figured that may be the case but there was a glimmer of hope that there may be a simple soltuion. Oh well. Off to the store for some battery supplies I go...

Thanks hippy :D
 

krypton_john

Senior Member
Yes, but to be honest, the time it would take to explain how or write the code for both PC and PICAXE and the aggravation of getting it to work everytime you re-power your PICAXE it would be far easier to just get a 3V battery. You'll probably find two AA's in a standard battery box will work. If it's a three battery holding box just link across the unused slot with a wire.

For Real Man (TM) DIY, two batteries in rolled up paper with wires wrapped round drawing pins all held together with elastic bands and sticky tape should do the job.

Now where's my Blue Peter badge ... ?

Come on Hippy, he just wants something temporary for his prototype, not some gold plated show-off piece or art!
:-D
 

hippy

Technical Support
Staff member
LOL. I suppose I should also mention - don't take it to an airport in that state unless you're wearing a bullet-proof vest :)

Wonderful thing paper, especially for making funnels. I think I've perfected that now but it does attract odd looks rolling up a sheet of A4 to top-up vinegar bottles.
 

moxhamj

New Member
Hippy is going to be awarded two Blue Peter badges today, because his fix also works for old PC motherboards where the lithium cell has gone flat.
 
Top