Tjaart van der Walt wrote: >I will use an external frequency source (62kHz or so) that >will be gated into the TMR/Cntr input of the PIC. Every >second I give a sync pulse (4us) that enables the counting. >When I receive the return pulse, I disable the counting again. >A simple blanking pulse to prevent the signal from the mic >from seeing the pulse from the speaker should prevent >zero distances. What do you think? It should work; if you issue pulses every second, reflected pulses should have time to disperse. Anyway, it is a good idea to stop the upper edge of the tube with muffling material (foam or so), to prevent resonance expecially when the length of the tube is near to the wave length of the overtones of the 1Hz signal you generate. Note that the open edge of a pipe still reflects the acoustic waves. There is another tecnique I know, although I have never tested it. If you feed the pipe with a continuous wave, you receive the reflected signal after it has run along the pipe backwards and forwards, so its phase is shifted as a function of the length of the pipe. You could then detect the phase shift (with a PLL, for example) and determine the level. In this case, however, you should absolutely eliminate the reflected wave, and use a frequency the wavelength of which is comparable with the length of the tube. Just another idea. Leonardo Perretti leo.perretti@projectpp.it