would it be possible to post the actual code you are using (in code tags preferably) not some edited portion.what are your config settings ? a schematic sketch could be in order. without the full story any solutions are just speculation
whats "front" ? where is that defined
this sort of code seems pretty awkward and may not really address the problem
have a go at something like thisinit:
pulsin portc.2 , 1, vara
if vara < 140 or vara > 160 then init
pause 100
pulsin portc.2 , 1, vara
if vara < 140 or vara > 160 then init
if vara > 140 and vara < 160 then goto beep
goto init
Code:DEFINE PULSIN_MAX 500 ; why wait longer if its already out of limits (may need adjustment) init_ok var bit init_ok=0 init: while portc.2 ; wait till portc.2 goes low wend while ! init_ok ; or init_ok=0 if you like pulsin portc.2 , 1, vara if abs(vara-150)<=10 then init_ok=1 wend




Bookmarks