c_mitra
Advanced Member level 6
In principle it is simple: you send the pulse as a digital write bit on a given pin. That output is connected to the wire whose length is to be determined. You also start the counter (clock at the same time).
Connect the same end to another pin and configure that as a digital read: as soon as you read 1 you stop the counter.
In reality, you may be needing some schmitt trigger or a monostable to remove noise and select a threshhold. Sometimes the reflected signal may get inverted (the reasons for this we need not discuss).
Finally you need to correct for various delays in the software.
Connect the same end to another pin and configure that as a digital read: as soon as you read 1 you stop the counter.
In reality, you may be needing some schmitt trigger or a monostable to remove noise and select a threshhold. Sometimes the reflected signal may get inverted (the reasons for this we need not discuss).
Finally you need to correct for various delays in the software.