BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Mon Oct 22, 2018 8:41 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: A problem with Ultrasonic Sensor HC-SR04
PostPosted: Fri Jun 01, 2012 5:40 pm 
Offline
New User

Joined: Fri Jun 01, 2012 4:54 pm
Posts: 1
Location: Poland
Hi everybody,

I'm beginner and i have serious problem :). I connect sensor that P3-VCC, P2-trigger (10us signal), P1-echo(time to signal from trigger back), P0 GND. I know thats maybe funny, but i just start :). Thats my code
Code:
HIGH P3;
HC_trigg CON P2
HC_echo CON P1
range VAR word

Main

low HC_trigg
pulseout HC_trigg,20 ;(for 10 us signal??)

pulsein HC_echo,0,range
range=range/74 ; range in cm?

Serout S_OUT,i9600,["Range: ",DEC range,13]
pause 1000

Goto Main


Top
 Profile  
 
 Post subject: Re: A problem with Ultrasonic Sensor HC-SR04
PostPosted: Sun Apr 14, 2013 12:06 pm 
Offline
Site Admin
User avatar

Joined: Fri Apr 12, 2013 8:38 pm
Posts: 87
Location: Nottingham, England, UK
HI,

It seems like the problem here is you are trying to use the AtomPro I/O pins as the power supply for your SR04 Ping Sensor and allthough you set P3 high to make it a +5V level the P0 Pin(Gnd) defaults to an input so there would be no power flow unless you set P0 to a 0V with a LOW P0 command,

That may explain why you are getting nothing right now BUT its not advisable to use the Atom Pro I/O Pins as a power supply as they can only provide a limited current and if your SR04 draws more than the pin can provide the Atom Pro could be damaged so the way to do it is to connect the GND and POWER pins of the SR04 to your 0V and +5V supply lines that are running the AtomPro IC and as well as allowing the SR04 to draw more power it frees up 2 of your I/O pins for other tasks,

I hope that helps and I am sure you will soon be up and running :D,

Thanks

Dave
BasicMicroUK


Top
 Profile  
 
 Post subject: Re: A problem with Ultrasonic Sensor HC-SR04
PostPosted: Mon Apr 29, 2013 7:18 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
Good catch Dave. I don't think I would have seen that one. Not something I'm use to seeing. :)

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


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 post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO