# how may I calculate the maximum frequency

Discussion in 'Embedded Systems and Microcontrollers' started by micropad, Jan 29, 2012.

Dec 24, 2011
38
0
Dear All
Please kindly teach me how may I calculate the maximum frequency that can be count using Timer0 and Timer1 in Counter mode (Timer1 in Asynchronous Counter mode)
Any equation highly appreciated
PIC is 16f877a

2. ### ErnieM AAC Fanatic!

Apr 24, 2011
7,447
1,628
You look these up in TABLE 17-6: TIMER0 AND TIMER1 EXTERNAL CLOCK REQUIREMENTS

Dec 24, 2011
38
0
Dear Erniem

Thank you very much for reply
I looked it, but it is bit confused me. can you please help me some extent

4. ### ErnieM AAC Fanatic!

Apr 24, 2011
7,447
1,628
Two symbols Microchip uses you should know are Fosc and Tcy.

Fosc is the clock frequency your crystal runs at.

Tcy is the time to run a single instruction.

And for PICs:

Tcy = 4/Fosc

What is your clock frequency?
What prescaler value are you using?

Last edited: Jan 30, 2012

Dec 24, 2011
38
0
Timer0 256

6. ### ErnieM AAC Fanatic!

Apr 24, 2011
7,447
1,628
If I'm reading Table 17-6 correctly....

Timer0 needs to meet items 40,41 & 42, so hi and low period of 10nS min each, and a min period of 20nS. That's 50 MHz for a square wave input..

Timer1 needs to meet items 45,46 & 47, so hi and low period of 15nS min synchronous and 25nS asynchronous, and a min period of 30 or 50 nS. That's 33.3 MHz or 20 MHz for a square wave input.

Item 47 saying a max of 200 kHz for Timer 1 is only when using the external oscillator on that module, not for driving with an externally generated signal.

These high to me but how I interpret the data sheet.

(I now believe I got this incorrect. See post http://forum.allaboutcircuits.com/showthread.php?p=451348#post451348)

Last edited: Feb 2, 2012