0
\$\begingroup\$

I am developing a data logger based on PIC controller. The PIC has internal RTC but does not have pins for connecting battery so I am using pic's internal RTC to generate interrupt every second and external battery backed RTC to keep exact timing. but the problem is that they both do not get in sync. So after every 5 second when I read time from external RTC it gives value 6 (or) 7. So how should I sync both RTC to get proper value from external RTC? We dont have pin from external RTC connected to MCU so cant get interrupt from external RTC.

\$\endgroup\$
  • \$\begingroup\$ Why is there no interrupt line between the two? \$\endgroup\$ – jippie Apr 20 '13 at 11:35
  • \$\begingroup\$ Actually I have no prior requirement of RTC so I haven't added it but now when the requirement is there I dont have free pin on MCU for interrupt. \$\endgroup\$ – Jimit Apr 20 '13 at 11:53
2
\$\begingroup\$

actually I have solved the problem. What I have done is that whenever device starts I read date and time from external RTC and update the internal RTC with same so now I have to monitor only internal RTC which keeps all the timing requirement till the device turns off. again when device starts I again read from the external RTC. So this solves the problem of synchronization.

\$\endgroup\$
0
\$\begingroup\$

Forget the internal RTC. Configure an internal timer for a frequency 10 to 1000 Hz and check the external RTC on timer interrupt. Then only when you read a different external time, do your thing.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.