1. From the Data sheet you see pin ?, the clock input
pin for timer 1 (varies by pic number). A 16F628A it is RB6
a 16F877 it is RC0 et. al . . . . Check your data sheet for
your particular PIC.

2. Look at the T1CON register in the datasheet. It is a byte
variable, 8 (bits). Bit 7 and Bit 6 are not used, just ignore
them.

3. Now look at bits 5 and 4. These are the bits you select based
upon your application. This is where you set the prescaler.


4. Now on to bit 3. This is the T1OSCEN bit. usually this is
turned off so make this a zero too.
1 = T1OSCEN on, 0= T1OSCEN off

5. We are at bit 2 now. To use timer 1 in counter mode, we choose
not to synchronize external clockinput, because we want to
count the incomming ticks, so set this bit as 1.

6. Now we are at bit 1. "This is our guy", this selects timer or
counter mode. Set this to 1 to count external pulses.

7. Bit zero at last. set bit zero to 1 and timer is enabled, set
to 0 and it is turned off. Use it this way in your code:


T1CON = %00110111 ' Sets up timer and prescaler
(zero bit 3-4 to alter prescaler)

the following code is put into your code where you want to start
and stop the counter/timer:
T1CON.1 'turn on timer
T1CON.0 'turn off timer

8. Now we come to the point where we see the number of ticks The
ticks are stored in a word variable, set up like this:
CounterTotal var word 'initialize variables needed for program.

9. The counts are stored in TMR1L and TMR1H and you set up the
variable like this: CounterTotal.LowByte=TMR1L
CounterTotal.HighByte=TMR1H
Prior to beginning to count at the start of program, zero
these as follows:
TMR1L=0
TMR1H=0
you may zero these for your own purposes anywhere in your
program or you may preload these with a value greater than zero.

10. Now look at the datasheet re: T1CON register and set
up the T1CON register for your program. The example below
is set up as follows:

Prescaler = 1:8 ' 8 counts in = 1 count out
T1OSCEN = off
T1SYNC = 1 ' do not synchronize external clock input
TMR1CS = 1 ' External clock from clock input pin
TMR1ON = 1 ' Timer is enabled and running


T1CON = %00110111 ' Sets up timer and prescaler(zero bit 5-4 to
alter prescaler)

That was easy, and yes I do keep these instructions available
to reference when I need them.