electronics forum

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

understanding timers in PIC16F84


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> understanding timers in PIC16F84
Author Message
eddy12345



Joined: 22 Jan 2008
Posts: 4
Location: united kingdom


Post14 Feb 2008 8:24   

understanding timers in PIC16F84


Hi guys,

I have a problem trying to make a counter that can handle a wide range of time.
Assuming that my prescaler is 4 and i mov 231 into TMR0

i get 4(256-231)uS = 100uS

and every time it overflows, i increase the value of a counter. In this case it will take 100uS for every count(untill the maximum value have been reached, which is 125).

How do i make a counter that can handle values between 1 to 5000? I want it to be that way because i will produce a set of time delay for the output :

1) 0mS for 600<count<5000
2) 4mS for 0<count<75
3)call table delay values for 75<count<600
4) restart program count>5000
Back to top
Google
AdSense
Google Adsense




Post14 Feb 2008 8:24   

Ads




Back to top
adidav



Joined: 19 Apr 2006
Posts: 15
Helped: 1
Location: Romania


Post14 Feb 2008 11:40   

Re: understanding timers in PIC16F84


Hi eddy12345,

Don't you use the timer1. Is a 16bit timer and you can have time period from a few us till ms.

Example:
Fquartz = 4MHz, Prescaler = 2

for TMR1 = 0 the time is 131.07ms
for TMR1 = 65500 the time is 70us

The calculations was made using the formula:
time = ((Fquartz * Prescaler) / 4) * (65535 - TMR1), the result is in us.

Greetings,
ADi
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 -> understanding timers in PIC16F84
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
timers (3)
555 Timers (5)
555 Timers (12)
Timers in PIC??? (1)
Programming Windows timers (3)
Timers and interrupts (12)
realtime clock using timers (2)
advice on timers in pic 18f452 (5)
PIC 18F452 8bit timers. (4)
INTERRUPTS and TImers in 8051 (11)


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