Thanks rootboy, so every 970miliseconds you call for an STI and trigger 1 second bit before jumping back to the next scan... right?
Anytime!
For that program, I would add 1 to a register, compare it to 60, and if it was equal to 60, then add 1 to the "minutes" register and zero out the "seconds" register. And so on for hours, days, weeks, etc...
I'm pretty sure that I just used ADDs and Compares to avoid having any problems with resetting counters in a routine that was only going to be called for just one scan per second.
I came up with the ~ 970 milliseconds by way of observation. Basically I started it in the morning and waited until the next day to see how far I had gotten off (this was before the plant had wired up the input from the Simplex clock so I didn't have to worry about it getting corrected at midnight). But if I recall correctly, it was accurate to a second or so per day.
And all that this program did was to start the Paint shop in Wentzville so it had a very deterministic scantime.
So 970 probably won't work for you. And 970 justs sticks in my mind, and it probably isn't correct. But it was in the upper 900's anyways. Since I wrote this program in 1994, a few of the details might be a bit fuzzy.
But it's easy to figure out what it needs to be, just let it run for as long as you can stand it and then do the math (actual versus calculated e.g. PLC logic). But be advised that in any case you will have to correct it occasionally.
The Simplex system would give me an eight second "on" pulse on the hour, and a twelve second "on" pulse at midnight. It was a simple matter to create two timers that would look for an eight second and a twelve second pulse (the Simplex system had just one input).