here is the code i may not be understanding the pulse command the sensor is an hc-sr04 thanks for the help

define osc 4
ANSEL = 0 ' set I/O pin to digital
CMCON0 = 7 ' set comparator off
osccon = $60
define osc 4


input GPIO.4 ' set GPIO.4 to input pin 3
OUtput GPIO.2 ' set GPIO.0 to output pin 5
output GPIO.1 ' set GPIO.1 to output pin 6
sens var GPIO.4
led var GPIO.2
trig var GPIO.1
dist var word


main:
gosub distance
low led
while dist < 8
high led
'pause 500
'low led
'pause 500
wend
goto main

distance:
high trig
pauseus 10
low trig
'pulsout trig,2 ' produces 10us pulse
pause 50
pulsin sens,1,dist 'reads echo pulse from sonar
dist= dist/15 'convert to inches
pause 100
return