timer0 , 1 and 2 in counting??

Status
Not open for further replies.

apple

Newbie level 5
Joined
Feb 21, 2005
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,370
hi, can i use neither timer0, timer1 or timer2 in PIC16F877 for counting purposes?? is it use interrupt for the counting???
 

Hi !

If I understand your question,

Timer 0 can be used for counting. It can count from 0 to 255 (8 bits) and it has an input pin for external pulses. TMR0 can also count using Fosc/4 pulses (the main PIC oscillator divided by 4). The inputs can be divided by a prescaler (shared with Watchdog Timer, but you can use the prescaler for TMR0 or WDT only once at time).

Timer 1 can also be used for counting. It can count from 0 to 65535 (16 bits) and it has an input pin for external pulses or to implement an additional low frequency oscillator (up to 200kHz xtal). The Fosc/4 option is available too. You can divide these signals by an prescaler (not the same of TMR0). TMR1 is also used in the Capture and Compare modules.

Timer 2 (8 bits) is less versatile because it does not have an external input, but only the Fosc/4 option. It has a prescaler for the counting pulses and is used mainly for the PWM module as a time base generator.

You can set interrupts when the timers get overflow and use them simultaneously (notice that using CCP modules, you won´t have them available for other purposes).
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…