You look in the datasheet for the particular PIC you're using, look up the section on the particular timer you're about to use, say TMR1. It'll tell you where the prescaler selection bits are (usually in T1CON for TMR1) and how to set them to get various prescaler ratios.
IF you run the PIC at 4Mhz the timer ticks at 1Mhz, it's 16bits wide so the longest time it can measure is 65.5ms, each "tick" is 1us. On the 16F877, for example, the highest prescaler ratio is 1:8 so the longest time possible to measure is 524ms....
TMR2 has a prescaler possible of 1:16 which will give you just over one second. EDIT: Sorry TMR2 may only be 8bits but look it for the PIC in question.
Depending on what else you're going to do with the PIC there are various ways to go about this. You can run the PIC at a much lower frequency, like 100kHz or something like that. Or you can use an external oscillator to clock TMR1. If you design a 1kHz oscillator and set TMR1 up derive its clock extarnally (again, see T1CON register for TMR1 details) you'll be able to measte 65535ms or ~65seconds with a resolution of 1ms.
Make the oscillator 5kHz and you'll get 200us resolution and you'll still be able to measure up to ~13 seconds.
/Henrik.
Bookmarks