assistance with Timer0 formula?

Status
Not open for further replies.

danieltimpo

Newbie level 1
Joined
Jan 27, 2018
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
7
pls am new in micros, and am working on Timer0. someone should help me with the calculations of this :- 1ms = (256 - TMR0)(1us)(1)
 

Re: asistance am in hot waters

Hi,

You should provide complete informations:
* what microcontroller
* link to datasheet
* what section/page do you refer to

What did you do so far?
What are the results?
Where exactely is the problem?

****
Your first job is to re-arrange the formula and solve it for "TMR0" value.
1ms = (256 - TMR0)(1us)(1)
* the (1) is useless and may be omitted
* "1ms" may be replaced with 1000us
* you may add a "×" between tge brackets
--> 1000us = (256 - TMR0) × 1us
* divide both sides with "1us"
--> 1000us / 1us = 256 - TMR0
--> 1000 = 256 - TMR0
* subtract 256 on both sides
--> 1000 - 256 = - TMR0
--> 744 = - TMR0
* subtract 744 on both sides, add TMR0 on both sides
--> TMR0 = - 744

Most probably (we don't know microcontroller type) your valid range is 0...255 (uint8), and thus you can't work with -744.
Therefore I assume (again we don't know what the datasheet says) you need to work with prescalers.

Klaus
 

Re: asistance am in hot waters

pls am new in micros, and am working on Timer0. someone should help me with the calculations of this :- 1ms = (256 - TMR0)(1us)(1)

what is the input clock to your Timer 0 ?

Are you using any pre-sacle value before feeding this clock to the timer ?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…