Really, what it is is calculating the new 1pps divisor for the timer > driving ISR, which divides down from the clock rate of the Arduino.
The trick is for integer math is to never do or postpone division. So if you have 1560 PPS per 1432 ticks (or whatever) the number is a rational fraction of 1560/1432 and you store it as two integer. The goals is to always be exact. that at the end you need to multiply maybe "23425" by the ratio it is easy (23425*1560)/1432. Store fractions as fractions. But you have to check yourself first if that might be an over flow. If so then shift it all over some number of bits and shift the answer back. -- Chris Albertson Redondo Beach, California _______________________________________________ time-nuts mailing list -- [email protected] To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts and follow the instructions there.
