hi guys,

thanks all for your help, but no luck so far, before the last suggested changes, the code will just stay on forever.
Now, with the ANSEL part, just wont compile, it says "syntax error".

Removing the ansel part, it compiles, i run it and after the boton is pressed it jumps direct to the last part of the code (off_led/off_mosfet)

This is my actual code:

Code:
cnt VAR BYTE
boton VAR GPIO.2
mosfet VAR GPIO.1


CMCON = 7

'Ports
Output mosfet
Input boton

cnt=0

CHECK:
high mosfet
IF boton = 0 THEN TEST
GOTO CHECK

TEST:
cnt = cnt + 1
IF cnt = 3 THEN OFF_MOSFET
GOTO CHECK

OFF_MOSFET:
cnt = 0
low mosfet
pause 1000
GOTO CHECK
end
Any sugestions?
Much appreciated, and thanks again.