hey guys, help with Ping)))
zeic
Posts: 1
I need to help me how to interface a microcontroller PIC 16F877A with your ping sensor
Comments
Welcome to the Forums!!
First off you will need to start by making the Pin that you select on your 16F877A a logic "LOW" and an output.
Then you will need to make that same pin a logic "HIGH" for about 10us (micro seconds) and then to a logic "LOW"
Immediately following that you will need to make the pin an input and time how long it takes for the pin to go "HIGH" again. <-- This HIGH will be the echo, and the time returned will be an arbitrary value that won't have any "weight" unless you know the precise unit of time (instruction clock speed) of your 16F877A. Keep in mind that this returned time will be the time of flight "there and back". If the pin does not go HIGH, then you will need to make previsions in code for the PING to timeout. This condition simply means that the PING sensor is aiming at something too far away to receive a valid echo response.
The PING))) itself times out after 20 milliseconds.
I've just been looking at this in another thread. Here are a couple of 'scope shots. Voltage on the pin is the yellow trace #1, and the trigger pulse is enhanced with orange and also shown time-expanded as trace #A. First shot shows a return echo of about 1ms. In the second shot, the PING))) times out at about 20ms, from pointing off into open space. The other thread had to do with how to make it time out sooner, for faster response.