I am using a distance sensor in my project and I need a little help on code.
Basically, the sensor works with two pins (PIN_1 trigger and PIN_2: Echo). when I put PIN_1 in logic level 1 the sensor sends a signal in a waveform when the wave find an object it will return and the PIN_2 echo will be logic level 1.
The question is: How can I measure the time between the trigger PIN_1 and receive the signal back on PIN_2
Data Project: PIC 16F877A, clock 4Mhz
Thanks in advanced, _________________ Rodrigo Lopes
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Thu Sep 09, 2010 11:08 pm
You should admit that you're using the Parallax Ping sensor or the
Devantech SRF-04, or something similar.
You can use the CCS delay routines, delay_us() or delay_ms() to create
the trigger pulse. Read the sensor documentation to see what is the
required length of the trigger pulse.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum