The countdown chain is reset whenever the seconds registeris written. Write transfers occur on the acknowledgefrom the DS3231. Once the countdown chain is reset, toavoid rollover issues the remaining time and date registersmust be written within 1 second. The 1Hz square-wave output,if enabled, transitions high 500ms after the secondsdata transfer, provided the oscillator is already running.
Ok, so it seems like I need to keep track of the number of mills from when the PPS goes off and then count up 500 mills and then set the time.I'll try and write up a simple sketch to test it out. Thanks!
It's simpler than that. When the pulse from the GPS occurs, get the time from the GPS, set the RTC with RTC.set() and the system time with setTime(). The falling edge of the 1Hz signal from the RTC should then be synchronized with the pulse from the GPS.Be sure to call setSyncProvider() in setup() to keep the system time in sync with the RTC time.
Being naive here, Is the pulse width from the RTC 500ms?
Try setting the seconds when the button is pressed. You could, for example, set up your code so that the user pushes the button at exactly the minute and the code then just sets the seconds to zero. I think that will do it.Pete