midi jdpetkov
The way I see it, the code of the PIC is easy to write. Simply increment PORTA (except RA4, which seems to me is used as the serial output), then read in PORTB, possibly complemented. The key code is then the concatenation of the two numbers: PORTA:/PORTB. Or it can be translated to something else, but that is relatively easy.
Overall, itt should be fairly easy to write.
However, expanding the keyboard means adding more decoders. But as you can see, PORTA has no free lines. So that would make things more complicated. Perhaps it would be easiest to change to another PIC, that has more I/O lines. Then the code can follow the skeleton above, without problems.
What kind of delay can you allow? I am thinking of using a shift register or something before the decoders. Thus, using only 2 or 3 I/O lines on PORTA you could create 8 or more, enough for all the decoders you need to add. But shifting in data serially takes time, that is why I am asking how often you actually need to scan the keys?
The second question is, do you know the codes for such a large keyboard? Would the computer recognize them, or do you need to update that software, too?