I'm no maths expert but I have come up with these eqations which might be of assitance. I make no guarantees as to their accuracy... ie. they may be wrong but I think they are right. If: t = time required (sec) f = clock frequency of the PIC (Hz) p = prescaler ie. 2, 4, ... 256 TMR0 = start value of TMR0 t = (256-TMR0)(4p/f) TMR0 = 256-(tf/4p) p = tf/(4(256-TMR0)) ___________________________________________ Wesley Moore RMIT - BEng/BApp.Sc. 2nd Year wmoore@cs.rmit.edu.au http://wmoore.tsx.org/ On Sun, 30 Jul 2000, Luis Fernando wrote: > Hi There, > > Is there any universel equation that i can use to get the right > prescalar that i need and the right number that i should put into the > TMR0 so that it can get the right timing ??? > > Thanks > R.C. > > > Hi, > Yes I saw it on the Myke Predko's book. > There are two way to get it... > If you want the delay.. > > Delay = (256 - InitTMR0 * prescaler) > ----------------------------------------- > Frequency / 4 > > Or if you want the value to put in TMR0 to get a determinate DELAY > > InitTMR0 = 256 - ( DELAY * Frequency ) / ( 4* Prescaler) > Ah! DELAY in seconds > > I hope that I could help you > > Regards > Luis F > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics