Hi here is the routine I use
RTC_brst_Wr movlw b'00101000' ; Select I2C master mode
banksel SSPCON
movwf SSPCON
movlw I2CRATE ; Set the bus speed
banksel SSPADD
movwf SSPADD
movlw b'00000000' ; And clear any status flags
banksel SSPSTAT
movwf SSPSTAT
call I2CStop ; Ensure the bus is free
;write to ds 1307 with user values
call I2CStart ; Take control of the I2C bus
movlw DS1307|I2C_WR
call I2CWrite ; Send the RTC write command
movlw h'00'
call I2CWrite ; And the register index
call I2CRestart ; Then restart the I2C bus
movf SECS, W
call I2CWrite
movf MINS, W
call I2CWrite
movf HRS, W
call I2CWrite
movf DOW, W
call I2CWrite
movf DAYS, W
call I2CWrite
movf MON, W
call I2CWrite
movf YRS, W
call I2CWrite
call I2CAck
call I2CStop
return