CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

I got a question about CCS C and Ultrasonic Sensor.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Brian
Guest







I got a question about CCS C and Ultrasonic Sensor.
PostPosted: Fri Apr 03, 2009 1:46 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Apr 03, 2009 2:39 am     Reply with quote

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








PostPosted: Fri Apr 03, 2009 6:23 am     Reply with quote

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.
PostPosted: Fri Apr 03, 2009 11:11 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Apr 03, 2009 1:30 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Apr 03, 2009 1:43 pm     Reply with quote

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.
PostPosted: Fri Apr 03, 2009 4:45 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group