This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

rtc time lag

Hello everyone,
I m interfacing a RTC of ds1307 with microcontroller c8051f020
I follow rtc datasheet
My circuit is working fine.
In the software, I m initializing the interrupt then smbus and after that rtc.
Initialization of rtc includes initializing internal oscillator and generation of 1 sec pulse
1 sec pulse is used as 1 sec interrupt
I read rtc after every one sec in while(1) loop. Flag is set in 1sec interrupt routine and display time on lcd
My problem is, when I switch on the machine I find the lag in seconds
To test it I switched off and on the machine several times and it was noticed that seconds lag is increasing
To check again, I downloaded the program and reset the microcontroller for several times and run it
Still I get lag in seconds as I increase the resets of microcontroller
Is it a mistake of my code or hardware fault?
Lag is of few seconds but if this continues then in a month it will be in minutes
thank u all

0