Load Google Translate how use ping altrasonic to compute range wih pic16f877a pic16f877a
I would suggest choosing a PIC microcontroller with CTMU. The CTMU is the perfect peripheral for such applications (e.g. measure very short time pulses).
A very good material is at the following link:
http://ww1.microchip.com/downloads/en/AppNotes/CTMU%2001375a.pdf
© 2009 Premier Farnell plc. All Rights Reserved
Premier Farnell plc, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE