Javier wrote: > > How can I emulate the open collector in the keypad ?? > I don4t fully understand, why it4s better to send 04s and not 14s This technique is used only if you will not put any external component (except for switches) on your keypad. To make the software simple, diodes and some pullup/down resistors are needed. To do without external components, the port (PORTB) must be programmed to enable it's weak pull-ups. That is why sending 0 is more economical because no resistors are needed. The port output registers must also be put to low and only work on the TRISB registers when pulling low the rows on each pass. setup: bcf STATUS,RP0 ;bank0 clrf PORTB ;set output registers low bsf STATUS,RP0 ;bank1 movlw 0xFF ;tristate movwf TRISB ; bcf OPTION,RBPU ;enable weak pull-ups ... ... (in keyread routine) ... movlw B'11111110' ;scan row ... movlw B'11111101' ... movlw B'11111011' ... movlw B'11110111' ... bsf STATUS,RP0 ;bank1 movwf TRISB ;enable particular row andlw 0x0F ;mask row movwf key ;save in key bcf STATUS,RP0 ;bank0 movf PORTB,w ;read port andlw 0xF0 ;mask column iorwf key ;combine with row regards, Reggie