0% found this document useful (0 votes)
656 views8 pages

4x4 Keypad

A 4x4 matrix keypad requiring eight Input/Output ports for interfacing isused as an example. Rows are connected to Peripheral Input/Output (PIO) pins configured as output. Columns are connected to PIO pins configured as input with interrupts. In this configuration, four pull-up resistors must be added in order to apply a high level on the corresponding input pins.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Topics covered

  • LCD interfacing,
  • technical documentation,
  • AT91 ARM microcontroller,
  • application note,
  • 4x4 matrix keypad,
  • hexadecimal key values,
  • software requirements,
  • board dimensions,
  • c programming,
  • keypad programming
0% found this document useful (0 votes)
656 views8 pages

4x4 Keypad

A 4x4 matrix keypad requiring eight Input/Output ports for interfacing isused as an example. Rows are connected to Peripheral Input/Output (PIO) pins configured as output. Columns are connected to PIO pins configured as input with interrupts. In this configuration, four pull-up resistors must be added in order to apply a high level on the corresponding input pins.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Topics covered

  • LCD interfacing,
  • technical documentation,
  • AT91 ARM microcontroller,
  • application note,
  • 4x4 matrix keypad,
  • hexadecimal key values,
  • software requirements,
  • board dimensions,
  • c programming,
  • keypad programming

1|P ag e

4x4 MATRIX KEYPAD

An ISO 9001-2008 Certified Company Order Code RDL/4X4KP/13/001/V1.0

4x4 Matrix Keypad


A 4x4 matrix keypad requiring eight Input/Output ports for interfacing isused as an example. Rows are connected to Peripheral Input/Output (PIO) pins configured as output. Columns are connected to PIO pins configured as input with interrupts. In this configuration, four pull-up resistors must be added in order to apply a high level on the corresponding input pins.

Features
Contact debouncing. Easy to interface. Interfaces to any microcontroller or microprocessor. Data valid output signal for interrupt activation.

Applications
Vending machines. Public phones. Ticketing.

Specifications
Parameter Operating force Key lifetime Value 60 +/- 20cN 1x109 million operations

[Link]

2|P ag e
4x4 MATRIX KEYPAD

An ISO 9001-2008 Certified Company Order Code RDL/4X4KP/13/001/V1.0

Pin Details
Pin Name 1-4 R0-R3 5-8 C0-C3 Details rows columns

Working
This Application Note describes programming techniques implemented on the AT91 ARM-based microcontroller for scanning a 4x4 Keyboard matrix usually found in both consumer and industrial applications for numeric data entry.,AT91 Keyboard interface In this application, a 4x4 matrix keypad requiring eight Input/Output ports for interfacing is used as an example. Rows are connected to Peripheral Input/Output (PIO) pins configured as output. Columns are connected to PIO pins configured as input with interrupts. In this configuration, four pull-up resistors must be added in order to apply a high level on the corresponding input pins as shown in Figure 1. The corresponding hexadecimal value of the pressed key is sent on four LEDs.

[Link]

3|P ag e
4x4 MATRIX KEYPAD

An ISO 9001-2008 Certified Company Order Code RDL/4X4KP/13/001/V1.0

Figure 1. Keyboard Interface

[Link]

4|P ag e
4x4 MATRIX KEYPAD

An ISO 9001-2008 Certified Company Order Code RDL/4X4KP/13/001/V1.0

Sample Application

[Link]

5|P ag e
4x4 MATRIX KEYPAD

An ISO 9001-2008 Certified Company Order Code RDL/4X4KP/13/001/V1.0

Code
/* * Project name: 4x4 Keypad Matrix * Copyright (c) [Link] * Description: * Test configuration: MCU: [Link]: Oscillator: Software: */ #include<stdio.h> #include"reg51.h" #define KeyPort P1 #define LCD_PORT P2 sbit rs=P3^5; sbit en=P3^7; sbit D7=P2^7; sbit rw=P3^6; void SEND_CMD_2_LCD(unsigned char); // function protoype void SEND_2_LCD(unsigned char *, unsigned char); // header file AT89S52 8051 11.0592 MHz Keil uVision3 void DISPLAY_ON_LCD(unsigned char DATA); char check_key(void); void delay(unsigned int time); void DELAY() { unsigned int X=800000; while(X--); } void main() { unsigned char LCD_CMD[]={0X38,0X0f,0X06,0X01,0X80},COU NT,TEMP1=0,kk; // LCD commands for(COUNT=0;COUNT<6;COUNT++) SEND_CMD_2_LCD(LCD_CMD[COUNT] ); // LCD INIT function call DELAY(); DELAY(); while(1) { SEND_CMD_2_LCD(0x01); SEND_2_LCD("Enter The Number ",0x80); SEND_CMD_2_LCD(0xC0); kk=check_key();DISPLAY_ON_LCD(kk); DELAY(); } }

[Link]

6|P ag e
4x4 MATRIX KEYPAD

An ISO 9001-2008 Certified Company Order Code RDL/4X4KP/13/001/V1.0 rw=0; en=1;

void busy() { D7=1; rs=0; rw=1; while(D7!=0) { en=0; en=1; } } void SEND_CMD_2_LCD(unsigned char DATA) { busy(); LCD_PORT=DATA; rs=0; rw=0; en=1; en=0; } void DISPLAY_ON_LCD(unsigned char DATA) { busy();LCD_PORT = DATA; rs=1;

en=0; } //*************************** void SEND_2_LCD(unsigned char *string, unsigned char POS) { SEND_CMD_2_LCD(POS); while(*string) DISPLAY_ON_LCD(*string++); } char check_key(void) { unsigned char colloc=0,rowloc=0, colloc1,rowloc1; unsigned char keypad[4][4]={'F','E','D','C', 'B','A','9','8', '7','6','5','4', '3','2','1','0'}; { do { KeyPort = 0X0f; do { colloc1 = KeyPort; colloc1 &= 0x0F; }while(colloc1 != 0x0F);

[Link]
delay(20);

7|P ag e
4x4 MATRIX KEYPAD

An ISO 9001-2008 Certified Company Order Code RDL/4X4KP/13/001/V1.0 else if(rowloc1==0xD0){ rowloc=1; } else if(rowloc1==0xB0){ rowloc=2; }

delay(20); KeyPort = 0x0f; colloc1=KeyPort; colloc1 &= 0x0F; if(colloc1==0x0E) { colloc=0; } else if(colloc1==0x0D) { colloc=1; } else if(colloc1==0x0B){ colloc=2; } else if(colloc1==0x07){colloc=3; } KeyPort = 0xf0; rowloc1 = KeyPort; rowloc1 &= 0xf0; if(rowloc1 == 0xE0) { rowloc=0; }

else if(rowloc1==0x70){ rowloc=3; } return(keypad[rowloc][colloc]); }while(1); } } void delay(unsigned int time) { unsigned int i; for(i=0;i<time;i++); for(i=0;i<10000;i++); }

[Link]

8|P ag e
4x4 MATRIX KEYPAD

An ISO 9001-2008 Certified Company Order Code RDL/4X4KP/13/001/V1.0

Board Dimensions
60mm

44mm

To buy this product click the below link [Link]

[Link]

Common questions

Powered by AI

Using an AT91 ARM-based microcontroller enhances the 4x4 matrix keypad's functionality by providing robust processing power and flexibility in handling multiple tasks, such as real-time interrupts for key detection. In industrial contexts, this allows the keypad to be part of complex systems that require reliable human-machine interfaces, capable of processing numerous input signals rapidly and accurately. The microcontroller's advanced features support extensive customization for diverse applications, from factory automation to data entry terminals, while maintaining effective resource management and system integration .

The coding strategy used in the matrix keypad implementation leverages direct manipulation of port data and a lookup table for efficient key mapping. By using precise bitwise operations and predefined tables, this method minimizes computational overhead and complexity compared to alternatives like extensive conditional branching or separate hardware decoders. This approach ensures efficiency by reducing response time and resource usage, allowing the microcontroller to handle other tasks simultaneously without significant delay in keypad input processing .

In the 4x4 matrix keypad, input detection is managed using interrupts on the PIO pins connected to the columns. This setup allows the system to immediately respond to a keypress by generating an interrupt, thus improving the responsiveness and efficiency of input processing. Pull-up resistors are added to ensure that the input PIO pins remain at a high level in the absence of a keypress. This configuration helps prevent false readings from floating pin voltages, thus maintaining stable and predictable input detection .

The main function orchestrates the sequence of operations by first initializing the LCD with a set of commands that configure the display for operation, including clearing the screen and setting cursor positions. It then enters an infinite loop where it sends a prompt ('Enter The Number') to the LCD to guide the user. Using the 'check_key' function, it detects keypresses on the keypad matrix, retrieves the corresponding key value, and displays it on the LCD. This loop allows continuous interaction, making the system dynamic and responsive to user inputs .

An ISO 9001:2008 certification implies that the company follows established quality management principles, ensuring consistency and reliability in production processes. For the procurement of matrix keypads, this certification suggests that the keypads are manufactured to a standard that prioritizes quality and safety. Using an ISO-certified company provides assurance that the products meet certain performance specifications and are produced in a manner that reduces defects and increases overall customer satisfaction .

The keypad's operating force specification of 60 +/- 20cN and a lifetime of 1x10^9 million operations make it well-suited for various industrial applications, such as vending machines and public phones, where durability and reliability are paramount. The specified operating force ensures that keys are not too sensitive, reducing accidental presses, while still being light enough for comfortable use. The extensive lifetime guarantees longevity in high-use scenarios, minimizing downtime and maintenance needs in industrial environments .

The 'busy' function in the matrix keypad system controls the timing of sending commands to the LCD display by checking the status of the D7 pin. This function ensures that the display is ready to receive new data before further commands or data are sent. The necessity of the 'busy' function lies in its ability to prevent data collisions that could arise from writing to the LCD while it is still processing previous instructions. This synchronization ensures reliable communication and updating of information on the display .

The 4x4 matrix keypad features contact debouncing and easy interfacing, allowing it to connect with any microcontroller or microprocessor. Contact debouncing ensures that only one signal is registered per keypress, despite mechanical noise from pressing the keys. This feature is crucial for accurate input detection. The easy interfacing with microcontrollers is facilitated by the layout: rows connected to output PIO pins and columns to input PIO pins with interrupts. This configuration ensures that when a key is pressed, a corresponding interrupt can be generated, detected, and processed by the microcontroller, allowing for efficient inputs .

Using a lookup table for key mapping in a keypad matrix allows for efficient translation of row and column indices to specific key values. This approach simplifies the code by removing the need for complex conditional statements, directly mapping each row-column intersection to a corresponding key character or value. In the example provided, a lookup table is defined within the 'check_key' function, mapping intersections to keys with values like 'F', 'E', 'D', etc. The function leverages this table by checking the row and column indices, and then returns the corresponding key from the table for display or further processing .

Challenges in interfacing the 4x4 matrix keypad with different microcontrollers include compatibility in terms of port configurations, handling of interrupts, and electrical characteristics like pull-up resistor requirements. These may be addressed by customizing the connections and software code to match the specific GPIO organization of the microcontroller in use, adjusting resistor values for optimal logic levels, and ensuring interrupt handling routines are tailored for the hardware platform. Proper documentation and understanding of both the keypad and microcontroller specifications are crucial for successful interfacing .

You might also like