I would use Darrel's interrupts to measure time.

http://www.picbasic.co.uk/forum/showthread.php?t=3251

Robert