Hi, As usual, I have some questions today... I am using the check_keys routine from Bob Blick. In fact, it only detects falling edges on portA. I am searching for a routine that could decide between a single press on a switch and a long press on a switch (more than 500ms or 1s). The reason is that I don't have so much I/O on my 16C84 and had like one switch to have more than one function. Can anybody help? -david P.S.: Thanks to everybody for the EEPROM writing, it works nicely since I am waiting for the write to complete :) ;-------- ; test for keypress and call time adjust if needed ;-------- Check_keys movf PORTA,w ;get port "a" xorwf keys,w ;compare with previous andlw b'00000111' ;only care about button pins btfsc STATUS,Z ;zero set=no buttons retlw 0 ;return xorwf keys,f ;store key value movlw 0x64 ;a fairly long delay will movwf scratch ;prevent key bounces Key_delay movlw 0xFF call Delay decfsz scratch goto Key_delay btfss keys,2 ;test "minutes" button goto Inc_mins btfss keys,1 ;test "tens" button goto Inc_tens btfss keys,0 ;test "hours" button goto Inc_hours retlw 0 ;must be a glitch. yeah, right!