Skip to main content
Application NoteNxp

C Coding for the Keypad Module of the MMC2001

This application note provides guidance on implementing C code for the keypad module of the MMC2001 microcontroller, covering hardware debounce, scanning, and decoding.

View application note

Overview

This application note assists developers in configuring the keypad module for the MMC2001 M•CORE microcontroller using C. The document addresses common keypad design challenges, including hardware-based debounce—which filters noise and spikes under 16ms—and the implementation of polling versus interrupt methods. It details the software structure through modular files (KEY.C, KEY.H, and KEY.LNK) and provides a step-by-step guide for decoding a 4x4 matrix keypad. Technical specifics include register configurations for KPCR, KPRE, KPSR, and KDDR, alongside pseudo-code for initializing registers, waiting for key input, and scanning columns and rows to identify active keys.

Use Cases

  • Developing keypad input interfaces for MMC2001 microcontrollers
  • Implementing software-based column and row scanning for matrix keypads
  • Configuring hardware debounce settings in NXP M•CORE devices
  • Translating assembly-level register bit control into C-based variables

Topics

MMC2001
M•CORE
keypad module
C programming
hardware debounce
4x4 matrix
register mapping
polling
AN1803
microcontroller

Referenced Parts

MMC2001

NXP

The MMC2001 is the first publicly available general-purpose M•CORE offering in the M•CORE product line.