by beefy » Wed Jan 31, 2018 6:25 am
Terry,
just got in from work and seen your post. Did a quick Google to get some info so the following is just off the top of my head (so I may be stuffing up here).
Anyway, based on the 3x4 matrix schematics I've viewed, you could connect the 3 lines to output pins and the 4 lines to input pins. Make sure you don't accidentally connect an O/P to an O/P pin. I'd check with Balazs if there's anything bad about doing that (output to input).
Then the macro would put each of the 3 O/P lines high in sequence. When O/P 1 is high, the 4 inputs are sequentially scanned. Then O/P 1 is put low, and O/P 2 is put high and the 4 inputs scanned again. Then O/P 2 is put low, and O/P 3 is put high, and the 4 inputs scanned, and so forth. So in one loop, you've scanned 3 sets of 4 buttons = 12 buttons.
That seems to be how it's done with a microcontroller, it's just looping through the set of switches till one is found closed.
I also read that you can only have ONE switch at a time pressed, based on the way a matrix keypad is wired. So you may need to do some pre-emptive thinking and figure out what the effects would be if someone pressed several buttons at the same time. A look at a matrix keypad schematic should quickly show what would happen.
Keith.