On 11/04/2013 07:00 PM, Frank Bemelman wrote:

> Assume you have an interrupt every 57 uS.
> 
> 
> [untested code]
> 
> int timervalue = 0;
> int msektimer = 0;
> .
> .
> .
> 
> timer_int()
> { timervalue += 57; // add the uS that have passed since previous interrupt
>  if(timervalue>1000) // a millisecond + some extra uS have past
>  { timervalue -= 1000; // keep the remaining uS
>    msektimer++; // keep track of total milliseconds
>  }
> }
> 
> Keeping track of seconds can be done in a similar way, just expand code.
> Sure there is some jitter on the timervalues, but a jitter of 57uS
> is usually not a problem for household purposes.

Clever.  I have been thinking about slowing the interrupts down
dramatically but I can't generate a precise decimal time interval that
way.  I'd been thinking about an algorithm but yours just solved it for
me.  Thanks much

John


-- 
John DeArmond
Tellico Plains, Occupied TN
http://www.fluxeon.com      <-- THE source for induction heaters
http://www.neon-john.com    <-- email from here
http://www.johndearmond.com <-- Best damned Blog on the net
PGP key: wwwkeys.pgp.net: BCB68D77

-- 
You received this message because you are subscribed to the Google Groups 
"neonixie-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neonixie-l+unsubscr...@googlegroups.com.
To post to this group, send an email to neonixie-l@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/neonixie-l/5278428E.2060607%40neon-john.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to