Thanks for the responses. The example show what I need, but I can't afford to just do nothing but run in a tight loop. I think I'll need to have some sort of interrupt routine instead.
I need to measure a tach signal. I have it wired to C2, which is a ECCP input. I think I should be able to use that to get counts but I'm not sure how to do that.