Ping))), serout problem!

Hello,
i need some help, please!!
i’m using “Ping Ultrasonic” With “Basic atom pro 28” mounted on “Bot Board 2” connected via serial cable to my computer
there’s somthing wrong with my code i hope you can help correct it, the ping flashes every 1 s as the delay i’m using and as it blinks on the terminal 1 screen “Distance:wrong value” shows up i dont know why??

BTW am using basic atom pro IDE v 08.0.1.7

cms        var  long
rawDist    var  long
PING_Scale var  long
Sonar_Pulse_Dat con P10

GetDistance


Low Sonar_Pulse_Dat
pulsout Sonar_Pulse_Dat, 10
RCTIME Sonar_Pulse_Dat, 1,rawDist
if rawDist > 65000 then
goto ErrorDist
endif
RCTIME Sonar_Pulse_Dat, 0, rawDist
PING_Scale.highword = 0
PING_Scale.lowword= 2260
cms = (rawDist */ PING_Scale ) / 2
goto GetDistanceExit
ErrorDist
cms = 0
GetDistanceExit
serout s_out,i9600,"distance:",dec cms,13,10]
pause 1000
goto GetDistance

I Really Appreaciate Your Help!!