Digital Inputs Interfacing Keypad

Slides:



Advertisements
Similar presentations
Khaled A. Al-Utaibi Interfacing an LED The Light Emitting Diode (LED) Applications DC Characteristics & Operation Interfacing to.
Advertisements

EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
Lab 9: Matrix Keypad : ”No Key Press” Analysis Slide #2 Slide #3 ”Press and Hold Key 5” Analysis.
Lab 7 : Decoders/Encoders : Slide #2 Slide #3 Slide #4 Slide #5 Slide #6 “1 of 10” Encoder “1 of 10” Encoder Connected to a SPST Keypad. Control Signal.
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
IR Control Materials taken from a variety of sources including IR Remote for the Boe-Bot by Andy Lindsay.
Khaled A. Al-Utaibi  Digital Vs Analog Signals  Converting an Analog Signal to a Digital One  Reading Analog Sensors with the.
Mark Neil - Microprocessor Course 1 Decoding and Using a 4x4 Keyboard.
SudokuEHG Michelle BrownMatt Haggenmiller Thomas Troch User Interface Rochester Institute of Technology Department of Computer Engineering Menus Used for.
7-1 Keypad Scanning interface Used for interfacing push-button(momentary) switches Used for large number(>8) push-buttons Relies on matrix arrangement.
Digital Outputs 7-Segment Display
Lecture – 7 Basic input and output
Embedded Programming and Robotics Lesson 9 Keypad and LCD Display 1.
Physics 120B: Lecture 4 LCD Text Display Keypads and Time Slicing Interrupts.
Course Project Self-Calibrating Prayers Clock
Khaled A. Al-Utaibi  What is Arduino?  Arduino Boards  Arduino Shields  Arduino Uno Hardware.
Digital Outputs LCD Display
 Keyboards, LCDs most widely used input/output devices of the 8051  Contents to be covered:  keyboard fundamentals  key press and key detection mechanisms.
1 4-Integrating Peripherals in Embedded Systems (cont.)
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
Practical Electronics & Programming
Introducing the UHC-HD for McDonald’s
Khaled A. Al-Utaibi  The Push Button  Interfacing Push Buttons to Arduino  Programming Digital Inputs  Working with “Bouncy”
Franz Duran INTRODUCTION TO A RDUINO PROGRAMMING & INTERFACING Engr. Franz Duran, MEP-ECE RapidSignal Electronics.
University of Houston ECE 5440/6370 Advanced Digital Design Lecture on Debouncing Circuit Yuhua Chen Spring 2010.
8279 KEYBOARD AND DISPLAY INTERFACING
Advanced Digital Circuits ECET 146 Week 9 Professor Iskandar Hack ET 221G,
1 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs.
Code The Arduino Environment.
July 7, 2003 Slide 1 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Introduction To Programming Chetan Jadhav Talib Bhabharawala Seung-Kook.
Arrays. Related data items Collection of the same types of data. Static entity – Same size throughout program.
Keyboard interfacing.
PPI-8255.
8279 KEYBOARD AND DISPLAY INTERFACING
EE 316 Computer Engineering Junior Lab Project 2 Digital Yahtzee.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington 2D arrays COMP 102 # T1.
In this activity, we are going to type a simple Chinese sentence with Microsoft Word by Tsang-jei Input Method and Simplified Tsang-jei Input Method. 1Start.
KEYBOARD INTERFACING Keyboards are organized in a matrix of rows and columns The CPU accesses both rows and columns through ports. ƒTherefore, with two.
Microcontrollers, Microcomputers, and Microprocessors
Alpha/Numeric Keypad Functions using AVR Preliminary Design Review Luke R. Morgan ECE /17/2008.
CSCI 130 More on Arrays. Multi-dimensional Arrays Multi - Dimensional arrays: –have more than one subscript –can be directly initialized –can be initialized.
ECE 3450 M. A. Jupina, VU, 2016 Capacitance Sensor Project Goal: Creation of a digital capacitance sensor circuit where a variation in capacitance changes.
Mark Neil - Microprocessor Course 1 Decoding and Using a 4x4 Keyboard.
MULTI-DIMENSIONAL ARRAYS 1. Multi-dimensional Arrays The types of arrays discussed so far are all linear arrays. That is, they all dealt with a single.
ECE 447: Lecture 12 Keypads ECE 447: Lecture 10. ECE 447: Matrix Keypad.
A LECTURE ON Arduino Interface With LabVIEW (Used Boards: Arduino UNO & Arduino MEGA 2560) By Satish Kumar Rai Assistant Professor Department of ECE BKBIET,
By by  Y.MADHU KEERTHANA (084A1A0459)  RAHIM BASHA (084A1A0441)  G.BABJI REDDY (084A1A0416)  V.REVATHI (084A1A0456 ) UNDER THE GUIDENCE OF….... Mr.T.E.ARAVINDAN,
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
Pulse-Width Modulation: Simulating variable DC output
BIRLA VISHVAKARMA MAHAVIDYALAYA TOPIC : Keyboard interfacing and flowchart MADE BY: Nidhi Bhangale ( ) Gargi Patel ( ) Meghna Rathod.
INTERFACING KEYBOARD WITH ATMEGA32 ELECTRONICS & COMMUNICATION TITLE.
Michael Rahaim, PhD Candidate Multimedia Communications Lab
Scrolling LCD using Arduino.
Peripherals – Keypad The Keypad provides a simple means of numerical data or control input. The keys can be attributed whatever data or control values.
4-Integrating Peripherals in Embedded Systems (cont.)
connect a DC-Motor with an arduino
Arduino & its hardware interfacing
DIGITAL CALCULATOR USING 8051
Arduino Part 1 Topics: Microcontrollers Programming Basics
‘SONAR’ using Arduino & ultrasonic distance sensor
Roller Coaster Design Project
Keypad Source: under under
1 Code
Arduino Board.
Add a Second Button and Set Point
Keypad Source: under under
Keypad Source: under under
Introduction to Arduino
Arduino म्हणजे काय?.
Interrupts.
Presentation transcript:

Digital Inputs Interfacing Keypad Khaled A. Al-Utaibi alutaibi@uoh.edu.sa

Agenda The Phone Keypad Scanning the Keypad Interfacing the Keypad Reading the Keypad Input

The Phone Keypad The phone keypad is a 4x3 key matrix consisting of 4 rows by 3 columns as shown in in the figure. When a key is pressed it connects its column pin to its row pin. For example, when key 5 is pressed it connects column 2 pin to row B pin.

Scanning the Keypad When interfacing the keypad to a microcontroller, we need to determine which key is pressed. This can be done using a very simple procedure called "key scanning". The procedure is performed as follows: (1) Apply Logic 1 on column 1 and Logic 0 on remaining columns. (2) Scan the logic signals on all rows A to D. (3) If a Logic 1 is read on one row then this indicates that the corresponding key (i.e. 1, 4, 7 or *) is pressed. For example if Logic 1 is read on Row B then this indicates that key 4 is pressed. (4) Repeat steps 1-3 for column 2 to determine if any of the keys (2, 5, 8 and 0) is pressed. (5) Repeat steps 1-3 for column 3 to determine if any of the keys (3, 6, 9 and #) is pressed.

1 Z 1 Z Z

Interfacing the Keypad The phone keypad can be interfaced to the Arduino Uno Board as shown in the next slide.

Interfacing the Keypad Design Example Interface a phone keypad to the Arduino Uno Board and write a simple program to display the value of pressed key on the Arduino environment’s built-in serial monitor

Interfacing the Keypad Design Example The code that will scan the keys and display the value of the pressed key on the Arduino environment’s built-in serial monitor consists of the following main pars: (1) Global variables declarations. (2) Input/output pins configurations. (3) Key scan logic. (4) Key value display logic.

Keypad Scan Example Global Variables Declarations In this part, an array is declared to hold character values corresponding to the buttons of the keypad // character values corresponding to the keypad buttons char [][] keypad = { {'1', '2', '3'}, {'4', '5', '6'}, {'7', '8', '9'}, {'*', '0', '#'} };

Keypad Scan Example Input/Output Pins Configurations In this part, we configure the digital pins of the Arduino board to scan the keypad as follows: Configure pins 0-2 as output pins to control COL1-COL3 of the keypad. Configure pins 3-6 as input pins to read ROW1-ROW4 of the keypad. // set pins 0-2 as outputs to control COL1-3 of the keypad for (int col = 0; col < 3; col++) { pinMode(col, OUTPUT); } // set pins 3-6 as inputs to read ROW1-4 of the keypad for (int row = 3; row < 7; row++) { pinMode(row, INPUT);

Keypad Scan Example Key Scan Logic In this part, we scan the keypad and return the character value of the pressed key or NULL if no key is pressed. (1) Set key value to null (2) For each pin 0-2 connected to COL1-3 do the following (a) Set the column HIGH (b) For each pin 3-6 connected to ROW1-4 do the following Read the state of the row If the state of the row is HIGH the do then set key value to the character corresponding to the pressed button (c) Set the column back to LOW (3) Return the key value

char getKey() { // set key value to null char keyValue = '\0'; // a variable to read the row state int rowState; // for each pin 0-2 connected to COL1-3 do the following for (int col = 0; col < 3; col++) { // set the column HIGH digitalWrite(col, HIGH); // for each pin 3-6 connected to ROW1-4 do the following for (int row = 3; row < 7; row++) { // read the state of the row rowState = digitalRead(row); // if the state of the row is HIGH the do the following if (rowState == HIGH) { // set key value to the character // corresponding to the pressed button keyValue = (keypad[row - 3][col]); } // set the column back to LOW digitalWrite(col, LOW); // return the key value return (keyValue);

Keypad Scan Example Display Key Value Logic In this part, we use the getKey() function to get the value of the pressed key: Get key value using the function getKey(). If the returned key value is not NULL then display the value on the serial monitor // get key value char key = getKey(); // if the key value is not NULL then if (key != '\0') { // display the key value on the serial monitor Serial.println(key); }