some things can cause this. Let's look this snip
	Code:
	IF AL=88 THEN 
     IF SONDU=1 THEN ARA 'if already off then ara
     GOSUB SON 'gosub off
     GOTO START
ENDIF
 You exit several time from a IF THEN and/or a nested IF THEN ELSE with a goto... not a good practice.  You  probably overflow the stack pointer.
as i read SONDU will be 0 or 1 so
	Code:
	ReturnToStart var Bit
Start:
ReturnToStart = 0
IF AL=88 THEN 
     IF SONDU=0 THEN 
          GOSUB SON 'gosub off
     endif
     ReturnToStart = 1
ENDIF
if ReturnToStart then GotoStart
 about the BUTTON statement... i'm not a fan of this statement. i'll prefer do 2-3 lines myself.
Let's say i want to monitor a pushButon on PORTA.1
	Code:
	TRISA.1=1
PushButton VAR PORTA.1
start:
     If PushButton then    ' Pushbutton active 
          While PushButton ' wait untill it's release
          Wend
          Pause 50 ' debounce time
          Gosub XYZ
     endif
 
				
			
Bookmarks