On 1/20/14 9:20 AM, Jim Lux wrote:

Interestingly, it occurred to me that one could just add a sufficiently
large deviation random number to the period each time to dither it.

The "rate" changes once per hour (per tvb's EOT routine), so there's
3600 ticks at a given rate. If I were to vary the rate (as set to the
routine) by, say, +/- 50 microseconds, the truncation to 16 microsecond
chunks will average out over the 3600 ticks in an hour. A quick
simulation shows sd of 1/2 microsecond for the result.

You need to add an 8 microsecond offset, because the SetPeriod routine
truncates, rather than rounds.

I'd like to keep it all in high level Arduino land, rather than delving
into counting cycles and ticks at a low level: makes it easier to move
to a new platform.




new dither code:

long newper = 1000000+ratedelta + 8 + random(-DITHERWIDTH, DITHERWIDTH);
      Serial.println(newper);
      Timer1.setPeriod(newper);


Seems to work ok.. (ran for a few minutes, checked the average period, etc.)


_______________________________________________
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Reply via email to