Help on SRF05 for basic stamp

I bought SRF05 and can't make it work on the basic stamp 2.. I am planning to make a robot with picaxe using this sensor. I can't start working on my 2nd robot unless I understand why the SRF05 can't work on BS2. Can anyone help me?

 

The Code I used is from SRF04(here): http://www.acroname.com/robotics/parts/R93-SRF04p.pdf

>I tried the echo and trigger separate but I can't achieve accuracy.. e.i. if i put my hand 1-1.5 feet in front of the sensor it detects 0 distance and if i don't it can see the wall 51 inch away.

The next Code I used with the change on wiring is from SRF05 documentation:

' {$STAMP BS2}
' {$PBASIC 2.5}

SRF05 PIN 6 ' use any pin for both trigger and echo
Range VAR Word ' define the 16 bit range variable

DO
SRF05 = 0 ' start with pin low
PULSOUT SRF05, 5 ' issue 10uS trigger pulse (5 x 2uS)
PULSIN SRF05, 1, Range ' measure echo time
Range = Range/29 ' convert to cm (divide by 74 for inches)
PAUSE 10

DEBUG CRSRXY, 0, 4, DEC Range, CLREOL
LOOP

>I always got 0 distance.

Can anyone point me on what I missed?


 

I don’t have a basic stamp,

I don’t have a basic stamp, but I have a couple of suggestions.

1: Check the wiring. Is the LED on the SRF05 flashing when you send the measurement signal? Did you connect the SRF05 as described in the single pin config (mode 2) by connecting the mode pin to GND?
2: Skip the Range=Range/29 part and debug the raw data