# how may I calculate the maximum frequency

Joined Dec 24, 2011
94
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

#### ErnieM

Joined Apr 24, 2011
8,355
You look these up in TABLE 17-6: TIMER0 AND TIMER1 EXTERNAL CLOCK REQUIREMENTS

Joined Dec 24, 2011
94
You look these up in TABLE 17-6: TIMER0 AND TIMER1 EXTERNAL CLOCK REQUIREMENTS
Dear Erniem

Thank you very much for reply

#### ErnieM

Joined Apr 24, 2011
8,355
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 prescaler value are you using?

Last edited:

Joined Dec 24, 2011
94
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 or Tcy = Fosc/4

4MHz
What prescaler value are you using?
Timer0 256

#### ErnieM

Joined Apr 24, 2011
8,355
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.