Reply
Posts: 25
Registered: ‎11-23-2015

timer calculator or timer calculation formula

Now i have use c8051f505 mcu for that any timer calulator is available for load the value of th0 and tl0 

As per delay required 

      If any sw is not available then tell me any formula for calucation of time delay for timer0,

timer1, timer2, timer3

Posts: 8,109
Registered: ‎08-13-2003

Re: timer calculator or timer calculation formula

there will be a lot of formulae, the timers are different, there are several clocking options, ....

 

a thing that makes it a bit easier (and more obvious) is to load the timer with ( 65536-value )

erik
Posts: 2,209
Registered: ‎10-14-2014

Re: timer calculator or timer calculation formula

Hi maheshraje27891

You could check the sample code for different mode in below folder to know how this is calculated if you install simplicity studio.

C:\SiliconLabs\SimplicityStudio\v3\developer\sdks\si8051\v3\examples\C8051F500DK\Timers\,

as Erik pointed out, basically it is dependent on the timer mode, clock source, presale, target frequency.

 

assume your target frequency is Rate, then the formula basically could be in below style (invert for count up):

Txx=(0ffff - ((SYSCLK/PRESCALE/RATE).

 

Denver

 

 

 

WeiguoLu
Highlighted
Posts: 3,025
Registered: ‎02-07-2002

Re: timer calculator or timer calculation formula


delu wrote:

Txx=(0ffff - ((SYSCLK/PRESCALE/RATE).

 


Off by one? Consider PRESCALE=1 and RATE=SYSCLK, that would give Txx = 0xffff - 1 = 0xfffe. This will give SYSCLK/2 instead of SYSCLK as output rate.

Posts: 2,209
Registered: ‎10-14-2014

Re: timer calculator or timer calculation formula

Thanks vanmierlo,

yes, you are right!

Sorry for this.

WeiguoLu