Hi Sander, Welcome!
You can use target_clock. See usart_common.jal for a good way to handle this (in the sense that it also rounds to the proper value). timer0_isr_interval.jal has a simple example (no rounding, less accurate). Joep 2009/5/7 savageio <[email protected]>: > > Hello Jallians, > > This is my first post to this list, I have been following it for a > while. I started with Bert's book and starterpack (a good place to > start) and have moved to jallib since. Enjoying myself very much. > I am not a complete beginner anymore, but still learning. Please > forgive any stupid questions... > > My question: I have been playing around with rc-servo's, and have an > tmr1 interrupt procedure that works nicely. If I want to put this > procedure in a library, what is the right/proper way to handle the > different xtal frequencies other users might have? > > I know that my xtal is 20Mhz, and am using a 1:8 prescaler so my tmr1 > ticks are 1,6 uSec each, but other users can have other values. They > have put "pragma target clock nnn" in the main program, can I somehow > retrieve this value in my library? I know I can find out the prescaler > from T1CON. > Or is this not the way to go? I have looked for a similar library, and > have found rtc_isr_tmr0 which just says what freq to use in the > comments. > > TIA > > Sander van Gelderen > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
