View previous topic :: View next topic |
Author |
Message |
Brian Guest
|
I got a question about CCS C and Ultrasonic Sensor. |
Posted: Fri Apr 03, 2009 1:46 am |
|
|
Hello,
First of all, if the topic does not suit this forum, please let me know.
I am using PIC 16f877.
I bought a PING))) ultrasonic sensor from www.parallax.com
I have no idea how to use it. It looks like very easy to use (just 3 pins)but I do not know that how to write a C code to measure distance.
Does anyone get experience about this device?
Any help will be appreciated.
Thank you very much.
Sincerely, |
|
|
tapasdas000
Joined: 02 Apr 2009 Posts: 5
|
|
Posted: Fri Apr 03, 2009 2:39 am |
|
|
hi
The sensor u got is only three pins from which 2 are power supply so u
only got the pin is sig pin for your controller. I have not much idea about that sensor but in these type of obstacle detectors sensor if the distance changes there is a change in voltage level with the o/p pin i.e sig pin in your case so why don't u try adc to measure the voltage level change on sig pin.
i mean if the distance is propersonal to voltage level on sig pin your problem is solved. |
|
|
Guest
|
|
Posted: Fri Apr 03, 2009 6:23 am |
|
|
Hi,
That is not correct. The third pin is a shared digital I/O pin used to trigger the module, and determine the distance measured. Distance is determined by the pulse width of a pulse on this pin following triggering. The datasheet is available on the Parallax website, so this is really where you need to start!
Chuck |
|
|
Brian Guest
|
I got a question about CCS C and Ultrasonic Sensor. |
Posted: Fri Apr 03, 2009 11:11 am |
|
|
Hello,
Thank you for your reply.
I tried ADC but it didn't work.
Yes, I read the datasheet but I do not know how to measure the width of a pulse. I do not know how to write the C code.
I can trigger it to start but I do not know what the next step is.
I used output_high and output_low commands to trigger it and I saw the green LED on which indicates the device on active status.
I do not know what I should do in next step.
This is my first time to use this device.
Any help will be appreciated.
Thank you very much.
Sincerely,
Brian |
|
|
languer
Joined: 09 Jan 2004 Posts: 144 Location: USA
|
|
Posted: Fri Apr 03, 2009 1:30 pm |
|
|
You should use the search function before posting an open-ended question like this.
Look at the following post: Sonar - Ultrasonic Range Finder |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 03, 2009 1:43 pm |
|
|
There is CCS source code on the internet. Search for this with Google:
Quote: | parallax Ping output_high |
It doesn't look like the highest qualitity code, but at least it will give you
some ideas. But, I am not sure the original poster knows how to
program in C:
Quote: | but I do not know that how to write a C code to measure distance. |
I don't want to help someone who has no knowledge of the C language. |
|
|
Brian Guest
|
I got a question about CCS C and Ultrasonic Sensor. |
Posted: Fri Apr 03, 2009 4:45 pm |
|
|
Hello,
Thank you for your reply and suggestion.
I searched for it on google but I forgot to search this forum first. It is my bad. I am sorry about that.
I will take a look forum which languer gave.
By the way, I got some basic knowledge about C and maybe I am not so good in C so that is why I do not know how to start it. Anyway I try hard to learn about it.
I really appreciated you guys' reply and help.
Thank you very much
Sincerely,
Brian |
|
|
|