16-KEY matrix KEYPAD using 74c922 16-key encoder ic

This is a 16-key matrix keypad project using the 74c922 16-key encoder ic (circa 1995) .

The wiring is straightforward.
The 74c922 datasheet shows the Truth Table on pg-4 and the layout and wiring on pgs. 6 & 7.
Rows 1 ,2,3 & 4 are ic pins -1,2,3 & 4 respectively.
Columns 1,2,3 & 4 are ic pins -11, 10,8, & 7 respectively.
OSC cap is 0.01 uF on pin-5 of ic.
KeyBounce Mask (KBM) (debounce cap) is 0.1 uF on ic pin-6.
Vcc is pin 18.
Gnd is pin-9
DATA_AV (Data Available) is ic pin-12 and goes to Arduino INT0 input on pin-2.
OE-NOT (Output Enable) is ic pin 13. (not used because if left unconnected the ic outputs are always available)
OUTA: ic pin-17 goes to Arduiino Port-B bit-0 at pin-8 (D8)
OUTB: ic pin-16 goes to Arduiino Port-B bit-1 at pin-9 (D9)
OUTC: ic pin-15 goes to Arduiino Port-B bit-2 at pin-10 (D10)
OUTD: ic pin-14 goes to Arduiino Port-B bit-3 at pin-11 (D11)

The PORTB bits 0-5 include pin 13 (PB5, bit-5) which although it is not used by the program , seemed to alway
read as HIGH so it was MASKED using the following AND operation:

total = PINB & B011111 ;

Here is the code for the program running on a SainSmart Arduino UNO-R3

const int intISR = 0; // Interrupt0 on pin 2
volatile boolean newKey = false;
volatile int Flagpin=6;
volatile int total=0;
volatile int Key=0;

                // 0	 1	 2	 3	 4	 5	 6	 7	 8	 9	 10	 11	 12	 13	 14    15
int totVals [] = { 1,	 2,	 3,	 10,	 4,	 5,	 6,	 11,	 7,	 8,	 9,	 12,	 14,	 0,	 15,    13};

void setup()
   attachInterrupt(intISR,readEncoder , CHANGE); 
   DDRB = B00000000; // set PORTD (digital 7~0)=INPUTS
   pinMode(Flagpin, OUTPUT);
  void loop()
       newKey = false;  
 void readEncoder() 
      total = PINB & B011111 ; 
       Serial.print("PORTB=  ");
      Key = totVals[total];
      Serial.print("key=  ");
      newKey = true;

Attached :
A terminal capture of the serial output showing the binary code read and the Key mapped to that value by the ARRAY.
The IDE source code program “*.ino” file.
A photo of the 16-key keypad used.
A WORD file with the keypad MAPPING info.

ClearTerminal_Capture__16_KEY_KEYPAD_.txt (906 Bytes)

Matrix_4x3_12_key_keypad_to_74c922_encoder_ic_ISR_PORTB_INT0.ino (938 Bytes)


In case it isn't obvious, the "A",B,C & D keys were mapped to those HEXADECIMAL VALUES (10,11,12,& 13) Since there was no "E" or "F" keys, the " * " (asterisk) was mapped to value 14 DEC and the " # " (pound) key was mapped to the value "15" to provide a full 16 HEXADECIMAL output code range.

FYI, The program filename still has 4x3 Matrix. That should have been changed to 4x4.

Here’s the keypad datasheet

matrix_4x4_keypad datasheet.pdf (116 KB)

Sorry for the 'way back' bump, but I just wanted to send a Thank You to raschemmel. :) I'm working on a Pro Micro project using a 3x4 keypad among other things. I had been planning on using the Keypad_MC17 Lib to support the KP as well as two BCD thumbwheels on a MCP23017. Which is fine, but when I stumbled onto this thread I had a 'lightbulb' moment. Checking my parts bins, dug up a 74HC923 \o/ Though it's a little over kill just as a 3x4 KP encoder, it's on hand and could encode additional switches not part of the KP. Plus it fits with the 'retro' nature of the whole project; using lots of my very old stuff for the UI, kind of '60s Ma Bell style. Using this chip saves a few pins on the MCP, but saves A LOT of CPU cycles, which I need. Planning on Midi in on Serial and Serial1, two Tx only SoftSerials for two DFPlayer MP3 modules, as well as all the UI on MCP23017 expanders. Thanks again, Yogi

A PCB board for interfacing the 4x4 keypad with a 74C922. The clear advantage of this chip: the Data Available pin can be used to signal the processor to read the pins… and the DAV pin stays HIGH as long as the key on the keypad is depressed.