# I need a strategy for pulse on change of second(t)

The core of my project is a W8BH clock, which uses an interrupt to sync the seconds to the risetime of the PPS pulse from the GPS. The platform is a Mega 2560.

What I need is a pulse that goes high at the transition from HH:MM:SS to HH:MM:(SS+1)

why: because I want to compare that to the PPS pulse from the GPS, to determine the lag between GPS & system time, to determine if it is consistent and stable. I have the required test equipment.

I determined that I need to manipulate the port directly via PORTE to set the pin HIGH with minimal lag time, and I have that capability figured out and working.

what I need now is a way to determine when the second rolls over. unfortunately C does not have a "when second(t) changes" interrupt.

does anyone have a scheme to trigger PORTE with minimal clock cycles?

How does the Arduino know the HH:MM:SS time?

And even if the Arduino does have a source for HH:MM:SS how can it generate a pulse without doing some maths. And if it does the maths (which will take a finite time) why bother with the pulse.

Also, I presume the GPS will provide its data over a serial link that will also involve a time delay.

…R

the Arduino Time library provides the HH:MM:SS. a variable named time_t second(t);

anent GPS: W8BH discovered that the pulse comes down the pike, then the serial data providing the time for the second pertaining to that pulse comes after the pulse. so he wrote his clock to adjustTime(1); when the next pulse hits the interrupt pin. set it with the data following the previous pulse, tweak it with the following PPS pulse. the speed and consistency of the serial link are rendered irrelevant with this procedure.

the pulse from a proper GPS module comes from the receiver before the serial data, and should reach its full rise within 20 microseconds of the pulse generated by the atomic clock at the National Bureau of Standards. I am trying to determine the characteristics of the clock after it is set by this procedure.

Now would be a good time to post your code to go along with that description.

the last time I posted the code somebody pitched a hissy fit because it was 18K of code. now, it’s 28k. it works very well for its intended purpose ( incursion monitor & doorbell. you supply your own sound effects, mine take up 280 megs ). you are welcome to it.

you have to remove the call to PPS(); in void loop to get it to compile. it’s a work in progress.

someone else will pitch a hissy fit because I did not list every library I used, separate from the list in the code, with links to most of the libraries in the code. it has been done. probably wants his grapes peeled, too.

yet another poster will pitch yet another hissy fit because I did not provide a link to every component used, with a price list converted to 78 major and minor world currencies

this is a fun forum.

RGPM_V0_2a.ino (27 KB)

Then post an MCVE. Nobody wants to wade through 28KB of unrelated clutter.

It's unusual, I know, but, karma for biting sarcasm.

So you didn't take the hint ?

...R