[Ovmsdev] Tick math

Gianluca Magalotti gianluca at magalotti.net
Wed Oct 22 13:38:21 HKT 2014


Ok, so you every 104.8576ms will add 5243MarkSecs (just invented a new time unit) right?
And when the counter reaches or pass 50000 you add one second and subtract 50000 to the count.
This way you are over 0.0024ms per timer interrupt, roughly 0.022ms per second, that is less than 2s per day (that is, every 43690s we count one second more.)

Please check my math.... But you won!

Gianluca Magalotti dal mio iPad mini

> Il giorno 22/ott/2014, alle ore 06:00, ovmsdev-request at lists.teslaclub.hk ha scritto:
> 
> Sorry, in my P.S., I think I miscalculated the improvement.
> 
> 1] Current methodology:
> 
> Signed 16 bit integer
> Every 104.8576ms timer interrupt, add 105ms to the counter.
> If counter >1,000 treat it as 1 second and deduct 1,000 from counter.
> 
> Accuracy: loses 0.1424ms per timer interrupt.
> 
> 2] 50ms methodology:
> 
> Signed 16 bit integer
> Every 104.7576ms timer interrupt, add 5243 to the counter.
> That is equivalent to 5242.88 50ms chunks.
> Difference is 0.88 / 50 ms
> Accuracy: loses 0.01760ms per timer interrupt
> 
> Or, is my new maths wrong? Is the inaccuracy 0.01760ms or 0.12ms per timer tick?
> 
> Confused, I am.
> 
> Mark.



More information about the OvmsDev mailing list