Exact match. Not showing close matches.
PICList
Thread
'[SX] SRF08 Ultrasonic sensor and SX/B'
2007\09\20@152927
by
Frassen/a
|
|
Hi,
I wonder if anybody out there has used the Devantech SRF08 Ultrasonic Sensor with SX/B?
It is quite straight forward to use the sensor with PBASIC but I fail to get it working with SX/B.
I assume I'm abusing the I2C-commands as the code compiles.
Any working code snippets or suggestions would be welcome.
A simple testprogram for the SRF08 follows, (cut from the Devantech website - http://www.robot-electronics.co.uk/htm/srfxxbs2p.htm ).
'{$STAMP BS2p}
'***********************************************************
'** **
'** I2C Routines for the Basic Stamp BS2p **
'** with the SRF08, SRF10 and SRF235 Ultrasonic Rangers **
'** **
'** Copyright 2005 - Devantech Ltd **
'** Commercial use of this software is prohibited **
'** Private and educational use only is permitted **
'** **
'** Written by Gerald Coe - February 2005 **
'** **
'***********************************************************
' Connect P8 (pin13) of the BS2p to the SRFxx SDA
' Connect P9 (pin14) of the BS2p to the SRFxx SCL
' Use 4k7 pull-up resistors from SCL and SDA to 5v supply
SDA CON 8 ' SDA on pin13, SCL on pin14
Ver VAR Byte
Light VAR Byte
Range VAR Word ' range
Loop:
I2COUT SDA, $e0, 0, [81] ' Rangeing command - 80 for inches, 81 for cm, 82 for uS
PAUSE 100
I2CIN SDA, $e1, 0, [Ver, Light, Range.HIGHBYTE, Range.LOWBYTE]
DEBUG 2,0,1, "BS2p to SRF08, SRF10 or SRF235 "
DEBUG 2,0,3, "Firmware Version ", DEC Ver, " "
DEBUG 2,0,4, "Light Sensor ", DEC Light, " (SRF08 only, Reads 128 on the others) "
DEBUG 2,0,5, "Range ", DEC Range," cm "
GOTO Loop
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=217998
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)
|
|
Please post your SX/B code. It will be easier than starting from scratch.
Bean.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=217998#m218009
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)
|
|
I have now, after some struggling, a working program for the SRF08 - hope it can be of some use to someone else out there.
The program will read version number, light value and range in cm's and send the range values out an attached RS-232 port at 9600B as 5 ASCII characters followed by CRLF.
The program can also be used to show the values using WATCH during debug mode.
Comments for this are included in the program listing.
You can find the program source attached to this reply.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=217998#m221208
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)
More... (looser matching)
- Last day of these posts
- In 2007
, 2008 only
- Today
- New search...