The following may prove useful.

Remember that the DS1307 stores all data in BCD format, so you will have
to convert your ASCII input into binary BCD before writing, and will have to
convert back from BCD when reading.


ClockAddr CON %11010000 ' RTC device address (byte addressing)
Offset CON 0
Cntrl CON %00010000 ' sets the SQW/OUT to 1Hz pulse, logic level low

I2CRead SDA_PIN, SCL_PIN,ClockAddr,Offset,[sec,mins,hr,day,date,mon,yr],ErrorTrap


I2CWrite SDA_PIN,SCL_PIN,ClockAddr,Offset,[sec,mins,hr,day,date,mon,yr,cntrl],ErrorTrap