@Mister_e,

I give you here the code. It is changed a lot of time but it is the last one which I used and by this program button is working a little bit for instance after 1-2 minutes it is making on and again 2-3 minutes later it making off also.

OPTION_REG.7=1

@ DEVICE pic16F628
@ DEVICE pic16F628, WDT_ON
@ DEVICE pic16F628, PWRT_ON
@ DEVICE pic16F628, PROTECT_OFF
@ DEVICE pic16F628, MCLR_OFF
@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT

'---------------------------Variab..------------------------------
AL VAR BYTE
TOPLAM var byte
KOMBI VAR BYTE
GIRIS VAR PORTB.0
ROLE VAR PORTA.1
TUS var PORTA.6
LED VAR PORTB.3
YANDI VAR byte
SONDU VAR Byte
I VAR BYTE
'-----------------------------MAIN ---------------------------
CMCON=7
CLEAR:TRISA=%01100000
TRISB=%00000011
PAUSE 500:AL=88:sondu=0:KOMBI=0:LOW LED

'-------------------------------------------------------------------------------
START:

BUTTON TUS,0,200,5,I,1,BAK

SerIn2 GIRIS,1646,10,ATLA,[WAIT ("ER"),AL]

ATLA:
IF AL=88 THEN
IF SONDU=1 THEN ARA 'if already off then ara
GOSUB SON 'gosub off
GOTO START
ENDIF

IF AL=66 THEN
IF YANDI=1 THEN ARA 'if already on then ara
GOSUB YAN 'gosub on
GOTO START
ENDIF
pause 1

ARA: GOTO START
'--------------------if button is pushed -------------------------
BAK: IF KOMBI=1 THEN 'if already on then gosub offf
GOSUB SON
AL=88
GOTO START
ENDIF
GOSUB YAN 'it is already off then gosub on
AL=66
GOTO START

YAN: '------------------on section-------------------
KOMBI=1
YANDI=1:SONDU=0
HIGH ROLE
HIGH LED
pause 1
RETURN

SON: '-----------------off section---------------------
LOW LED:KOMBI=0
SONDU=1:YANDI=0
LOW ROLE
pause 1
RETURN