I am using the Timer 1 in the PIC16F877. I know that the timer 1 has 2 modes -
1. Timer mode
2. Counter mode
and this can be choosen by setting or clearing the TOCS bit.
However when i choose the counter mode this what i want to accomplish -
1. I was to start counting
2. Then switch off the counter mode
3. Save the current value in the counter and store it in any random register.
4. When we switch off the Counter mode I do not want the Timer mode to come in effect.
Hi,
1. Select required prescaler and load T1CON with ur configuration required
2. Set TMR1CS bit in T1CON for selecting External clock, this to configure TIMER1 as counter
3. Clear TMR1H and TMR1L registers
4. Set TMR1ON bit to start counting
5. To stop counting, clear TMR1ON bit. Timer will not start.
6. Read the count from registers TMR1H and TMR1L and store it to ur registers
If u want to count again perform operations from step 3