STMicroelectronics AN1799 STR71x GPIO Scanning 4x4 Matrix Keypad Application Note

The aim of this application note is to show how to scan the 4x4 matrix keypad multiplexed with a four 7-segment display. The software attached to this application note scans the pressed key and displays it on the multiplexed 7- segment LEDs. This application note describes how the interrupt capability of the STR710 device is used to offer a better key scan.


STMicroelectronics AN1799 STR71x GPIO Scanning 4x4 Matrix Keypad Application Note - cover page
Brand
STMicroelectronics
Category
microcontrollers
Document type
Application Note
Language
English
Pages
7
File format
PDF
File size
103 KB
Published
07 August, 2012
Updated
28 September, 2023
Model
STR71x
MD5 checksum
12AE9B2C2F3BF25225A099C02AB737F8

About this manual

This application note explains how to interface a 4x4 matrix keypad with four 7-segment displays using the STR71x microcontroller. It details the hardware layout where eight lines are assigned to LED segments and four lines drive the displays through sink transistors. The keypad rows are connected to external interrupt pins to detect key presses.

The document provides specific configuration instructions for the STR710 microcontroller, including setting up GPIO ports for input and output modes and configuring the External Interrupts Unit (XTI) to trigger on rising edges. It also includes software details, such as the timing for scanning (5 ms duration every 20 ms) and a table of hexadecimal key codes for the 16 keys.

What's inside

  • Introduction
  • Hardware Layout
  • STR710 Configuration
  • GPIO Port Configuration
  • XTI Configuration
  • Software Keypad
  • Software Displays
  • Flowcharts
  • Key Codes Table
  • Legal Disclaimer

Specifications

Keypad Size4x4 matrix
Update Rate50 Hz
Scan Duration5 ms
Scan Interval20 ms
Voltage Level3.3 V

Frequently asked questions

How is the keypad connected to the STR710?

A 4x4 keypad is interfaced to PORT1 & PORT2, with rows connected to external interrupt pins and columns to output pins.

What triggers the external interrupt for key scanning?

An interrupt is triggered when a rising edge is detected on lines P2.8-11 caused by a pressed key.

How is the key code determined?

The MCU executes the XTI IRQ handler routine to decode the pressed key based on the row and column values.

Download PDF (103 KB)

More STMicroelectronics Manuals


View all STMicroelectronics manuals →