try this code. change c.4 to suit the input pin you are uning. the result shold be in w1
For more help, a schematic and code would help to solve you problem.
Symbol trig = C.4 'SRF005 range sensor ADC input
Symbol range = w1
pulsout trig,2 ' produces about 20uS pulse (must be minimum of 10uS)
pulsin trig,1,range ' measures the range in 10uS steps
pause 10 ' SRF005 mandatory 10mS recharge period after ranging completes
let range = range * 10 /29 ' multiply by 10 then divide by 58 for 4meg or 28 for 8meg