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.
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.
| Keypad Size | 4x4 matrix |
|---|---|
| Update Rate | 50 Hz |
| Scan Duration | 5 ms |
| Scan Interval | 20 ms |
| Voltage Level | 3.3 V |
A 4x4 keypad is interfaced to PORT1 & PORT2, with rows connected to external interrupt pins and columns to output pins.
An interrupt is triggered when a rising edge is detected on lines P2.8-11 caused by a pressed key.
The MCU executes the XTI IRQ handler routine to decode the pressed key based on the row and column values.