The keyboard matrix can be any size from 2x2 to 8x8.Pins SL2-SL0 sequentially scan each column through a counting operation. The 74LS138 drives 0's on one line at a time. The 8279 scans RL pins synchronously with the scan. RL pins incorporate internal pull-ups, no need for external resistor pull-ups. The 8279 must be programmed first. First three bits given below select one of 8 control registers (opcode).
000DDMMM
Mode set: Opcode 000. DD sets displays mode. MMM sets keyboard mode. DD field selects either:
8- or 16-digit display
Whether new data are entered to the rightmost or leftmost display position.
Encoded: SL outputs are active-high, follow binary bit pattern 0-7 or 0-15.
Decoded: SL outputs are active-low (only one low at any time). Pattern output: 1110, 1101, 1011, 0111.
Strobed: An active high pulse on the CN/ST input pin strobes data from the RL pins into an internal FIFO for reading by micro later.
2-key lockout/N-key rollover: Prevents 2 keys from being recognized if pressed simultaneously/Accepts all keys pressed from 1st to last.