A timer library would be very nice indeed! Personaly, I use timer frequently to generate an interupt (flag) at a specified rate. This takes that the desired frequency is converted to prescaler and a register value. I do this by hand but automagic would be great ;)
> procedure timer_wait_till_tick( word in ticks) is Does this procedure take the wrap around into account? Then it would be very usefull! Could you also provide a non-blocking function(timer_check_if_tick() or alike?). And in the process, you need the code to handle the wrap-around. Maybe you could make that available through the api too. Joep 2009/7/31 AlbertF <[email protected]>: > > Hello, > I was thinking of creating a generic library for the 8 and 16 bit > timers. For almost every project with PICs I've used the timers wihin > the PICs. So I browsed through my JAL source files and looked for a > common timer pattern(s) I've used. Below a first shot how the > interface, which can be used to start the discussion. In addition it > would be nice to have a wiki page with the timer related registers > (Seb?). > > > const TIMERX_TICKS_PER_SECOND = 1200 > > > -- reset timer, set value to 0 > procedure timerX_reset() is > end procedure > > -- enable timer X > procedure timerX_enable() is > end procedure > > -- disable timer X > procedure timerX_disable() is > end procedure > > -- get the current timer value > function timer1_get() return word is > end function > > -- block until ticks value < timer value > procedure timer_wait_till_tick( word in ticks) is > end procedure > > -- initialize timer > procedure timer1_init() is > end procedure > > -- enable timer X > procedure timerX_enable_interrupt() is > end procedure > > -- disable timer X > procedure timerX_disable_interrupt() is > end procedure > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
