Hi alain.

thanks for the "while" and maths suggestions and for the complement on my code, I will implement them. the checking for a change on RB0 is because the receiving circuit is set to be extremely sensitive and I am not sure what state the comparator, that is connected to RB0, will be in (either 0V or 5V) thats why i'm checking for a change so that regardless of what state the comparator is initially i will stop timer1 as soon as possible. if the code was this: if PORTB.0 = 1 and initially the comparator was at a high i would get an instant stop without even receiving a signal. well in my mind it makes sence :-)

The calculation is got from one of my physics books and modified it to get rid of any decimal places and to work the distance out in one. it uses temperature in celcius rather than Kelvin.

thanks for the link, lets see if they are willing to send overseas :-)

Cheers and thanks again for the help!

- Guy