Quote Originally Posted by Megahertz View Post
Hi, it works fine with 2500. Can you please explain how you calculated 2500? Thanks
Being Honest ...

1) read Datasheet Page 3 ...
4: PWM - PWM Output 025000USEvery 50US represent 1cm
2) read PbP Manual page 133 ...

The resolution of
PULSIN is dependent upon the oscillator frequency. If
a 4MHz oscillator is used, the pulse width is returned in 10us increments.

3) The distance is 5 meters = 500 cm

from 1) and 3) ...

4) Pulse will be 500cm * 50µs/cm = 25 000 µs

from 4) and 2) ...

@4 Mhz Pulsin will return 25 000 / 10 = 2 500 units

This is the mathematical explanation of zeu thing

Alain

PS@ Dave

Don't you think I should add " Need Help " in my signature validity conditions ???