So this is for ultrasonic distance measurement? And you need to generate a burst of ultrasonic signal? You're making a parking distance measuring device, are you?
One way to do this is to use an output compare module to toggle an output pin when a timer reaches a certain value. You clock the timer from a known frequency source and have it incrementing steadily all the time. When you want to generate a burst of ultrasound, you read the timer, add a bit, and program that value into the output compare register, and set the output compare logic to drive your pin high. When the timer reaches that value, the pin goes high. You detect the output compare match, and program the output compare block to drive the pin low when the right time arrives for the falling edge of the cycle. Then repeat for the next rising edge, and so on.
I assume you have circuitry to toggle a pin when the reflection is detected? That can trigger an input capture from the same timer, so you can calculate the time from when the burst was transmitted to when the reflection was received.
The best way to structure the software for this depends on what else the micro will be doing. What interrupt sources are active, how often do they fire, and how long do the interrupt handlers take? What's your ultrasonic frequency? What's your clock frequency for the PIC?