I am also doing this type of project these days...
I am using CCS as the programing C language.
when you trigger the sonar set the timer1 to 0..and use the CCP in capture mode..When you receive the sonar signal back ..you can take it as a interrupt for CCP1 and ...then the CCP1 value relates to the distance..
If you want more details tell me...