Depending on the PIC you're using, you probably have several onboard timer/counters.

Here's one example: http://www.picbasic.co.uk/forum/show...=pulse+counter

Enter pluse counter in the forum search box to turn up several more.