.. I would suggest
2variable timer0.tick
(and double calcs) otherwise it runs over in 65secs. But it depends
on the requirements of course..
p.
----- PŮVODNÍ ZPRÁVA -----
Od: "Matthias Trute" <mt...@we...>
Komu: "Everything around amforth"
<amf...@li...>
Předmět: [Amforth] Timer related things
Datum: 15.6.2012 - 21:34:05
> Hi,
>
> I've collected a few timer related things from my
> sources and
> extracted some useful (at least I hope that they
> are useful)
> words for a common library of timers.
>
> They can be found at the subversion repository in
> the
> trunk/lib/hardware directory.
>
> The timer library is layered: basic routines use
> the
> hardware timer 0 (or 1) to generate a millisecond
> tick. The current settings assume a 16MHz device
> (e.g.
> Arduino's). This will need adjustment for other
> frequencies.
>
> Above the hardware layer is a generic timer module
> that
> uses the tick information to provide generic timer
> related tasks:
> - after (runs a word after a specified amount of
> ms
> - every (runs a word every xy ms, a special case
> is
> every-second)
>
> and a few more words.
>
> In the timer-test.frt are some use cases.
>
> The routines assume a multitasking environment,
> esp the "every" part will block any interaction
> if called in the command line task. pause is
> called
> very often (the word passed to every is not
> executed
> in background but the whole thing may be used in
> background tasks)
>
> There may be some additional delay (2ms per cycle)
> as per
>
> : test-every-second @tick u. key? ;
> ' test-every-second every-second
> 439 1441 2443 3445 4447 5449 6451 7453 8455 9457
> 10459 ok
>
> so the "after" means "at least wait xy
> milliseconds, maybe more."
> (serial IO needs its time)
>
> I'm currently happy with what the words do (good
> enough).
> Next step is to write some recipes on how to use
> the library.
>
>
> Matthias
>
> PS: to find the optimal settings for the TWI/I2C
> I've written a small
> web-calculator at
> http://amforth.sourceforge.net/recipes/twi.html
>
> ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> Exclusive live event will cover all the ways
> today's security and
> threat landscape has changed and how IT managers
> can respond. Discussions
> will include endpoint security, mobile security
> and the latest in malware
> threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Amforth-devel mailing list for
> http://amforth.sf.net/
> Amf...@li...
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>
--
- - Reklama - - - - - - - - - - - - - -
Běháte rádi? Nyní máte jedinečnou možnost zúčastnit se
neuvěřitelného závodu do schodů, kdy za účast v závodě můžete vyhrát
nové auto. Zároveň uděláte něco pro své zdraví a podpoříte Unicef.
Více na http://bit.ly/Kqd1wL
|