thank you both for your replies i have looked at your link but as arcman said am very beginner but today i programmed the sensor again using flowcode and i think i am getting to make it work right this time but it seems that my problem is that ...
am using timer1 with 1:1 prescaler and using a 8 mhz crystal and with division by 4 ,timer1 will overflow after about 131 milli seconds and that is more than enough for the sensor ???is this right???because it lowers its echo after about 35 milli seconds
i send a trigger pulse to the sensor for at least 10 micro seconds then i start timer1 >>>t1con=0x01
and then i wait for the echo pin to go low so i use a while loop statement "or an if statement" that while echo=1 keep looping and as soon as the echo pulse goes low the loop is finished and do this >>>t1con=0x00 stop the timer and get timer1H and timer1L bytes values like this
FCV_TIMER1H=tmr1h; FCV_TIMER1L=tmr1l; this is how it is done using flowcode
then my question which i still dont know its answer is that after i do this
distance=((TIMER1H<<
+TIMER1L)/58
the distance defined as an integer will be what in cm's ok but what is its maximum and minmum values and if i want to compare it would i just say if distance>100 for example let pin b0 high and else let pin b1 high,would that be right or what??also do i have to use timer1 overflow interrupt???
this is the C-code for the srf05 using flowcode,