This solution is good but you have to keep in mind that you cannot use it for 2 or more simultaneously pressed keys and in battery operated units with floating power supply.
Your note is very appropriate. 2 or more simultaneously pressed keys can not be recognized. For battery operation can be added a routine like this:
if sample > 900 and sample < 1015 then
LCDOUT $FE, $80," Low battery "
KeyPressed=255
endif
dear kalpakchiev
not find 4bit bcd or binary output port
best reagards..
Having
KeyPressed value it is easy to add an lookup table and set 4 I/O to corresponding BCD code.
Best regards