One of the best examples of measuring frequency with impressive accuracy is here:
http://www.picbasic.co.uk/forum/showthread.php?t=1137

On post #21.