Warning this code is messy and not a particularly good way of doing it. Despite that, it does work and does what I wanted it to.

I only provide these files in the hope it helps someone doing a similar project. If you wish to just learn about TWI (i2c) and AVRs generally and not specifically to read and write the DS1307, then see other sample projects on this site. They are better commented, more cleanly written etc.

It is fully functional. Time is sent via the serial port (running at 9600 baud).

You can set the time by sending "sHHMMSS". The string must start with a lower case 's' and then the mext two numbers are Hours, then Minutes, then Seconds.

No validation is done of the received numbers, so if you enter 30 as the hour, you will get unexpected results from the DS1307.

Link to files

Not this project was created in Programmers Notepad. All projects after this are created in AVR Studio 4.12 RC2