I needed to have some short of debouncing of an input in order to accept it in my program.
In my program I am looking if the input has a High(+5V) or Low(0V).
The input is driven by the contacts of a relay which cannot oscillate.(If this happened I believe this could cause the program to hang)

INPUTPORTBIT VAR PORTx.x
COUNTERA VAR BYTE
INPUTPORTBITFLAG VAR BIT
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' subroutine CHECKINPUTPORTBIT
CHECKINPUTPORTBIT:
COUNTERA=10
CKCK:
Pause 100
IF INPUTPORTBIT=0 Then
COUNTERA=COUNTERA+1
IF COUNTERA=20 Then WAYOUT1
Else
COUNTERA=COUNTERA-1
IF COUNTERA=0 Then WAYOUT2
EndIF
GoTo CKCK
WAYOUT1:
INPUTPORTBITFLAG=1 ''OK OUR INPUT WAS STABLE FOR AT LEAST 1 SEC
GoTo WAYOUT3
WAYOUT2:
INPUTPORTBITFLAG=0 ''NOT OK
WAYOUT3:
Return

I used this routine(it is working for me Ok since yesterday) which ,I think, has some nice features like making the debouncing ''light'' or ''heavy'' by altering the PAUSE and/or the COUNTERA start and limit value.
Perhaps someone can improve it or make it with less code?
Please comment
Bill