Author: jsuijs
Date: Wed Jul 8 13:02:09 2009
New Revision: 1098
Modified:
trunk/include/peripheral/timer/timer0_isr_interval.jal
Log:
Modified: trunk/include/peripheral/timer/timer0_isr_interval.jal
==============================================================================
--- trunk/include/peripheral/timer/timer0_isr_interval.jal (original)
+++ trunk/include/peripheral/timer/timer0_isr_interval.jal Wed Jul 8
13:02:09 2009
@@ -6,8 +6,40 @@
-- This file is part of jallib (http://jallib.googlecode.com)
-- Released under the ZLIB license
(http://www.opensource.org/licenses/zlib-license.html)
--
--- Description: Fixed interval isr with support for non-blocking delays.
+-- Description: Fixed interval isr with support for non-blocking delays.
+--
+-- The setup of this library is straight-forward. First you define the
interval
+-- of the interrupt you want. With a higher value, more interrupts are
generated.
+-- This gives a higher resolution of your delay, but also puts a high
background
+-- load on your PIC. Be carefull if you go beyond 1000 (1kHz). The lowest
possible
+-- rate depends on the clock frequency you use and is 77 with an 16f877 on
20 MHz.
--
+-- >>> const timer0_isr_rate = 1000 -- 1 kHz isr rate
+--
+-- Next, you need to specify the number of slots. A slot is used to store
the
+-- end-time of a delay-period so you need one slot for each concurrent
delay.
+--
+-- >>> const DELAY_SLOTS = 2 -- support 2 delays at the same time
+--
+-- Now, include the library and call it's init function:
+--
+-- >>> include timer0_isr_interval
+-- >>> timer0_isr_init() -- init timer0 isr
+--
+-- Now we are ready to use the delay functions. To demonstrate it's use,
we take
+-- two LEDs and let them blink at their own interval:
+--
+-- >> forever loop
+-- >> if (check_delay(0)) then
+-- >> set_delay(0, 409) -- 409 ticks on delay-slot 0
+-- >> led = !led
+-- >> end if
+-- >> if (check_delay(1)) then
+-- >> set_delay(1, 619) -- 619 ticks on delay-slot 1
+-- >> led2 = !led2
+-- >> end if
+-- >> end loop
+--
-- TODO:
--
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---