7:30 AM - 7:30 PM
Monday to Saturday

Keypad Decoder Integrated Circuits

Keypad Decoder Integrated Circuits

Introduction to Keypad Decoders

A keypad decoder IC allows a microcontroller to interface with a matrix keypad. It scans the keypad to detect when a key is pressed and outputs the corresponding key value. Keypad decoders reduce the number of microcontroller IO pins needed and handle debouncing and ghosting detection.

Some common keypad decoder ICs:

  • MM74C922 16-key decoder
  • CD74HC922 20-key decoder
  • PCF8574 I2C IO expander, can support matrix keypad when combined with software

Advantages of Using a Keypad Decoder

  • Fewer microcontroller IO pins required
  • Handles ghosting detection – when multiple keys register as pressed
  • Debouncing – removes switch bounce noise
  • Simplifies software, offloads keypad scanning to hardware

Keypad Decoder Functionality

  • Scans column and row lines of a matrix keypad
  • Detects when a button is pressed
  • Outputs a unique value for each button press
  • Debounces the electrical noise from button contacts
  • Prevents ghosting from multiple simultaneous key presses

Keypad Decoder ICs Comparison

Decoder# of KeysInterfacePackageNotes
MM74C92216DirectDIP-16/SOIC-16Industry standard 16-key decoder
CD74HC92220DirectDIP-20/SOIC-20Similar to MM74C922, supports 20 keys
PCF8574ConfigurableI2CDIP-16/SOIC-16I2C IO expander, keypad function requires software
  • MM74C922 and CD74HC922 provide dedicated keypad scanning and decoding logic. They allow direct connection to a matrix keypad.
  • PCF8574 is an general purpose I2C IO expander chip. It can interface with a keypad when combined with software to handle scanning and decoding. Provides flexibility but requires more programming.
  • For small keypads of up to 20 keys, dedicated decoder ICs are usually best. For larger or more complex keypads, a programmable IO expander may be preferred.

Interfacing a Keypad Decoder

To use a keypad decoder IC:

  1. Connect row and column lines of the keypad matrix to the corresponding pins on the decoder.
  2. Provide pull-up resistors on the column lines. This enables the key press detection.
  3. Connect power and ground to the decoder chip. Make sure to decouple the power lines.
  4. On the microcontroller, connect decoder data outputs to input pins. No resistors are needed for CMOS/TTL compatible pins.
  5. Initialize and enable the decoder by setting control pins correctly as per the datasheet.
  6. Scan the decoder outputs to detect button presses. Each data line corresponds to a unique key on the keypad.
  7. Optional strobes or interrupt lines can provide faster key press detection.

Properly interfacing the decoder is critical to reliable performance. Follow the datasheet closely for pinouts and electrical characteristics.


Keypad decoders like the MM74C922 and CD74HC922 provide a simple solution for reading matrix keypads. They reduce microcontroller pins and handle debouncing and ghosting. For larger keypads, programmable I/O expanders can provide added flexibility. With robust connections and software, keypad decoders enable easy user input in embedded systems.

Frequently Asked Questions

What is debouncing and why is it needed with keypads?

Debouncing refers to filtering out the rapid connect/disconnect noise when a mechanical switch first closes. It is needed because the metal contacts bounce against each other several times before settling. The keypad decoder IC does this debouncing electronically so the microcontroller sees a clean signal.

How does a keypad decoder prevent ghosting?

Ghosting occurs when multiple keys register as pressed at the same time. The decoder prevents this by scanning the matrix in a way that only reads the first key press. Additional simultaneous keys are ignored until the next scan cycle.

Can multiple microcontroller pins be saved by using a decoder?

Yes, a matrix keypad without a decoder requires microcontroller pins for each row and column. This number grows quickly with bigger keypads. A decoder with multiplex scanning reduces this to just 2 or 3 pins plus data lines for each key.

What is the maximum number of keys supported by common decoders?

The MM74C922 supports up to 16 keys, while the CD74HC922 supports up to 20 keys in a single matrix keypad. For larger keypads, multiple I/O expanders and software decoding can be used.

How fast are key presses detected with a decoder IC?

The decoder scanning speed determines key response time. Simple decoders sample the keypad around 10 to 50 times per second typically. Faster detection is possible using interrupt outputs or advanced coding techniques.