Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 24, 2024, 10:34:37 10:34


Login with username, password and session length


Pages: [1]
Print
Author Topic: help using pbp pro and SRF05 sensor  (Read 5991 times)
0 Members and 1 Guest are viewing this topic.
spurs21
Cracking Team
Active Member
****
Offline Offline

Posts: 152

Thank You
-Given: 35
-Receive: 50



« on: June 03, 2008, 03:51:40 03:51 »

Hi friends, i have bought a SRF05 sensor and today has arrived to me Cheesy. I'm trying to test it with an 16x4 LCD but it does not works like i want, maybe im wrong in my code, i know that is very simple but i don't know why it does not works.

the info about this senor is here: http://www.msebilbao.com/notas/downloads/Medidor%20Ultrasonico%20SRF05.pdf

and this is my code:
Code:
Echo VAR Portb.2
Trigger var Portb.4 
Ancho var word
Dist_cm var word

trigger = 0

main:

trigger = 0
pulsout trigger,1
pulsin echo,1,ancho
dist_cm = (ancho/29)
LCDOUT $FE, 1
LCDOUT "CM =", DEC DIST_CM

goto main

end
Logged

pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 4668

Thank You
-Given: 834
-Receive: 4321


There is no evidence that I muted SoNsIvRi


« Reply #1 on: June 03, 2008, 12:01:12 12:01 »

English data sheet http://ltc.cit.cornell.edu/courses/ee476/FinalProjects/s2008/cl457_yft2/cl457_yft2/datasheets/SRF05.pdf
looking at your code I would say your pulse out is too short 1us or 2us, it needs min 10us. echo pluse is returned in upto 25us if target is found and 30us if no target found.

Code:
SRF05 PIN 15                   ' use any pin for both trigger and echo
Range VAR Word               ' define the 16 bit range variable
SRF05 = 0                        ' start with pin low
PULSOUT SRF05, 5             ' issue [color=red]10uS[/color] trigger pulse (5 x 2uS)
PULSIN SRF05, 1, Range      ' measure echo time
Range = Range/29              ' convert to cm (divide by 74 for inches)
[/pre]
Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
spurs21
Cracking Team
Active Member
****
Offline Offline

Posts: 152

Thank You
-Given: 35
-Receive: 50



« Reply #2 on: June 03, 2008, 11:46:50 23:46 »

hi thanks for your answer man, i have fixed it  Grin, i was using a 4MHz crystal now i'm using a 20Mhz crystal and like u say the pulse with was very short, now its working ok thanks and regards  Smiley
Logged

Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC