help understanding timers

Status
Not open for further replies.

sayf alawneh

Junior Member level 3
Joined
Aug 15, 2014
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
256
here is my problem first of all am using pic 16f877a
timer 0 is 8 bit timer and timer 1 is 16 bit timer ,ok
if am gonna use one of them as a frequency counter from an external source what is the difference between using any of those 2 timers for frequency counting purpose ????
using an 8 bit timer or 16 bit timer how can that effect my frequency meter????
also how can i know the maximum frequency i can measure using those timers????
and what is the relation between the max measured frequency and the timer being 8 or 16 bits ???? :/
forgive me guys i know u may think those r silly questions but am still a newbie and they cause me headache
and asking stupid question is better than being stupid for ever
 

Hi,

8bit vs 16 bit counter.
An 8 bit counter counts 0...255 then overflows and restars with 0...

A 16 bit counter counst 0...65535 then overflows and restars with 0...

That's the difference.

*********
What max counter frequency...
Tells you the datasheet.

Klaus
 
As KlausST said, the maximum number is the difference.

I don't know how your program is, but the timer size can change the working principle.

One way to measure frequency is counting pulses (with timers) and reseting the count every a determined time. If you know how many pulses has been in a time period you know the frequency, basic mathematics.

Depending of the counter reset frequency (depends of the measuring range you want) you can reach different maximum frequency measurement ranges.

If you reset the counter every 1s then the lower frequency you'll be able to measure is 1Hz and 255Hz if using 8bit timer and 65KHz if using the 16-bit one.

You can also increase the "timer size" by increasing a counter every overflow, but then you'll have to sum the whole number to calculate the frequency. It is possible.
 

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…