If I've understood correctly, the requirement is to send a short burst of 40kHz to an ultrasound transducer, that short burst consisting of eight 25us active pulses with 25us spacing between each.
I've seen similar eight pulse requirements in DIY ultrasound range finders but I've never seen any explanation as to why eight pulses are required; can more or less be used ? That may make things easier.
However many pulses, I don't think that's possible using just an 18M though it should be possible using PWMOUT plus some external logic, a counter and some gating to allow only eight pulses through.
It should be possible to use HSEROUT on an X1 or X2 with a 40,000 baud rate. HSEROUT 0,($55) would send five pulses ( start bit plus four data bits ), HSEROUT 0,($55,$F5) should send eight pulses with the required timing. It would be worth checking with a scope that the timing is correct but I would expect the data to be sent back-to-back.
An 18X can have its SFR's poked to send bytes at 40,000 using the internal UART and I think back-to-back data transmission can be achieved.
Getting the transducer activated is only half the story; detecting an echo and being able to determine the time is the other half, and probably more than half the work. All-in, it's easier to use a dedicated module like the SRF04 / SRF05 which is much easier to interface to.