I've created (yet another) 4x4 matrix keyboard decode-routine. I've placed 4 NOP's in it, because in a similar routine, they also were there (bad reason) , but I'm not sure if they are needed. They are there to let the output-pins when the pattern on portb is changed. But are they nescessary? Scan_4x4 **************** ;OK CLRF Key ;Returns: key value in Key MOVLW .4 ;No keypress: Key = b'00010000' MOVWF Counter Scan_loop MOVF Mask,W ;Mask MOVWF PORTB ;Put mask on port NOP ;Let pins settle NOP ;But is this nescessary?? NOP NOP NOP NOP BTFSS PORTB,0 ;IS first bit clear? RETURN ;Yes, so that row was pressed INCF Key BTFSS PORTB,1 RETURN INCF Key BTFSS PORTB,2 RETURN INCF Key BTFSS PORTB,3 RETURN INCF Key RLF Mask,F ;Check next column DECFSZ Counter,F GOTO Scan_loop RETURN ;No keypress: Bit 4 from Key = 1. Hans