Wan Zulhelmi Wan Ahmad Kamar wrote: > Hi, I'm using a PIC18f252 with an ultrasonic transducer to receive > signal of 40kHz. The thing is that I want to calculate the time from > the moment the first data arrive until the second data arrive. How > can I do that? Hi Wan, Ok, I gave you a software delay approach because that is what you decided on in a previous post, but after the new information you posted, you don't need a software delay after all. You can use the CCP module: Check out Microchip's application note AN597: AN597 Title: Implementing Ultrasonic Ranging http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824& appnote=en011066 Best regards, Ken Pergola _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist