Hi,

I am trying to make a menu selection SUB that will not exit until select button is pressed. I am using the PIC18F4550

Code:
Selection var PortC.6
Next1 var PortC.7
'/////////////////////////////////////   
'///////  GetModeOfOperation  ////////
'/////////////////////////////////////
GetModeOfOperation:

	Lookup Op_Mode, [55,65],Operation_Mode
	
	Select Case Operation_Mode
	Case 55 								
		lcdout $FE,1,  " Charger Mode "
	Case 65 								
		lcdout $FE,1,  " Recycle Mode"
	End Select
	
		lcdout $FE,$C0, "Next or Select"
		pause 200
		
		if Selection=1 then return
		if Next1=1 then Op_Mode = Op_Mode + 1
		if Op_Mode > 1 then Op_Mode = 0
		Gosub GetModeOfOperation

Return
The problem, is that my sub routine exits (return) after 4 seconds while nothing has been pressed.