electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

how to calculate time(seconds) with 8051 timers????


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> how to calculate time(seconds) with 8051 timers????
Author Message
info_req



Joined: 20 Jun 2007
Posts: 44
Helped: 1


Post17 Jan 2008 8:02   

8051 2 second timer


dear all,
i want to calculate time using 8051 timers, clock is 12MHz. i.e how to program timer for 1000000???

can i use timer0 and timer1, so that they count more than 16 bit????
thanks
Back to top
microlab



Joined: 04 Mar 2006
Posts: 106
Helped: 3


Post17 Jan 2008 11:49   

timers in 8051


Dear Friend

you can use any timers
but the maximum count you can get is only 65535+1
because the timer is a 16 bit timer
you can use other methods to get your required counts
but if you need exat timimg you should take care

ml
Back to top
vsmGuy



Joined: 26 Jun 2006
Posts: 489
Helped: 28


Post17 Jan 2008 13:25   

mcs51 use timer


use timer in a loop
Back to top
Google
AdSense
Google Adsense




Post17 Jan 2008 13:25   

Ads




Back to top
asoom



Joined: 28 Dec 2007
Posts: 247
Helped: 56
Location: jordan


Post17 Jan 2008 14:25   

how to calculate 8051 timer


as mentioned, use two timers in loops. which means make a 65535 counts for the counter in the internal loop update the count for the timer in the external loop by 1. and so you'll achieve number of counts larger than 65535 (16 bits)..
Back to top
Freddie Chopin



Joined: 08 Dec 2007
Posts: 103
Helped: 6
Location: Poland / Wroclaw


Post17 Jan 2008 15:52   

how to calculate time in seconds


asoom wrote:
as mentioned, use two timers in loops. which means make a 65535 counts for the counter in the internal loop update the count for the timer in the external loop by 1. and so you'll achieve number of counts larger than 65535 (16 bits)..

there is no need for 2 TIMERs to do that... how exactly are you going to increment a TIMER with ... a TIMER INT? you just need a timer and some variable to do the counting of interrupts.

0x41 0x56 0x45!!
Back to top
aupa



Joined: 22 Feb 2007
Posts: 58
Helped: 1


Post17 Jan 2008 21:33   

calculating time in 8051 interrupts


Hi!
in every timer0 interrupt, set the TH0 and TL0 to accurate frecuency and use a counter variable.

This variable is the auxiliar to use longer times than 16 bits
Back to top
waseem



Joined: 13 Apr 2005
Posts: 241
Helped: 35


Post18 Jan 2008 7:05   

calculate timer count


Hi!
You can do this very accurately by using just one timer.
See the complete keil project that is attached. Study the code carefully.
Ask if still not clear about the code.
Regards.



Sorry, but you need login in to view this attachment

Back to top
sankalani2003



Joined: 10 Oct 2007
Posts: 50
Location: Kandy,Sri Lanka


Post22 Jan 2008 5:09   

login calculate time


use this.


Sorry, but you need login in to view this attachment

Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> how to calculate time(seconds) with 8051 timers????
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
How to calculate time in 8051??? (2)
How to measure a process time with using 8051? (5)
INTERRUPTS and TImers in 8051 (11)
Units of Time Constant are Seconds... But Why? (10)
how to calculate time (8)
555 Timers - random on / off time (4)
how to calculate execution time in matlab programming (1)
How to calculate the PLL locking time? (2)
how to calculate backup time of the battery (1)
How to calculate the time constant of 5 order RC ladder ? (1)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS