Texas Instruments Microcontroller HOW-TO GUIDE Interfacing Keypad with MSP430F5529

Similar documents
ARM HOW-TO GUIDE Interfacing Keypad with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing Relay with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing Switch with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing 7SEG with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing GLCD with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing Buzzer with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing Stepper Motor with LPC2148

ARM HOW-TO GUIDE Interfacing I2C-7SEG with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing GLCD with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing GPS with LPC2148 ARM

ECE2049 Homework #2 The MSP430 Architecture & Basic Digital IO (DUE Friday 9/8/17 at 4 pm in class)

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interfacing External Devices using Embedded C Module No: CS/ES/22

LABORATORY MANUAL EMBEDDED C LABORATORY. M. Tech I Year I Sem R13 DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGG.

8085 HOW-TO GUIDE Interfacing 8251 with 8085

ECE2049: Embedded Computing in Engineering Design A Term Fall Lecture #8: Making it work: LEDs, Buttons & Keypad

ECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives:

LC-E201A. Application note. 1. Mechanical Specification: LC-E021A-application note page 1 of 16 Revision:

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #7: More Digital IO

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

CPE 323 Introduction to Embedded Computer Systems: MSP430 System Architecture An Overview

acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.

Real Time Operating Systems Application Board Details

Embedded Systems. Embedded Programmer. Duration: 2 weeks Rs Language and Tools. Embedded System Introduction. Embedded C programming

LCD. Configuration and Programming

Using peripherals on the MSP430 (if time)

The industrial technology is rapidly moving towards ARM based solutions. Keeping this in mind, we are providing a Embedded ARM Training Suite.

ECE 372 Microcontroller Design

Diploma in Embedded Systems

Interfacing CMA3000-D01 to an MSP430 ultra low-power microcontroller

MEPCO SCHLENK ENGINEERING COLLEGE, SIVAKASI. Department of Electronics and Communication Engineering COURSE INSTRUCTION MANUAL

ECE 4510/5530 Microcontroller Applications Week 7

C Language Programming through the ADC and the MSP430 (ESCAPE)

Interfacing CMR3000-D01 to an MSP430 ultra low-power microcontroller

Embedded Systems. Software Development & Education Center. (Design & Development with Various µc)

Advanced Embedded Systems

Review Activity 1 CALL and RET commands in assembler

Asservissement en température numérique d'une cavité ultra-stable au LPL pour le Strontium

Getting Started with the Texas Instruments ez430

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

Why embedded systems?

Using a Temperature Sensor

CPEG300 Embedded System Design. Lecture Interface with Peripheral Devices

Texas Instruments Mixed Signal Processor Tutorial Abstract

ECE2049: Embedded Computing in Engineering Design A Term Fall Lecture #9: Exam Review w/ Solutions

ECE2049-E18 Lecture 6 Notes 1. ECE2049: Embedded Computing in Engineering Design E Term Lecture #6: Exam Review

// sets the position of cursor in row and column

WIZTECH AUTOMATION SOLUTIONS (P) LTD., An ISO 9001:2000 and IAO certified company

@databasescaling Wednesday, 18 th April 2013

8051 Advance Trainer

KNJN I2C bus development boards

Stellaris LM3S3748 Evaluation Kit README FIRST

Serial-out Color Sensor. Overview. Features

Interrupts, Low Power Modes

Dragon12 LCD Displays Hantronix_CLD.PDF data sheet (Dragon12 CD-ROM) Dragon12 LCD Display. The Dragon12 board has a 16 character x 2 line display

Own Your Technology Pvt Ltd. Own Your Technology Presents Workshop on MSP430

ARM Microcontroller Interfacing - Warwick A. Smith ISBN Elektor. Table of Contents

Alex Milenkovich 1. CPE/EE 421 Microcomputers: The MSP430 Introduction. Outline

8051/8052/8031 Microcontroller

Human Eye Ball recognition system

Lecture (09) PIC16F84A LCD interface LCD. Dr. Ahmed M. ElShafee

Copyright 2015 by Stephen A. Zajac & Gregory M. Wierzba. All rights reserved..spring 2015.

LCD AND KEYBOARD INTERFACING

Name: Clint Furrer Project Number: TI003 Project Description: Safety Walking Lights. Description:

Programmable Device Interface PDI-1 A Versatile Hardware Controller with USB interface

Technical Specification for Educational Robots

EXPERIMENT NO. 02 ELECTRONIC VOTING MACHINE USING 8051.

Dragon12 LCD Displays Hantronix_CLD.PDF data sheet (Dragon12 CD-ROM) Dragon12 LCD Display. The Dragon12 board has a 16 character x 2 line display

CPE 323: MSP430 Timers

CoiNel Technology Solutions LLP. LPC2148 ARTIST Instruction Manual LPC2148 ARTIST. Instruction manual. Revision 1

AVR Peripheral Board. Campus Component Pvt. Ltd.

ECE2049-E17 Lecture 6 1. ECE2049: Embedded Computing in Engineering Design E Term Lecture #6: Exam Review

BV4218. I2C-LCD & Keypad. Product specification. December 2008 V0.a. ByVac 2006 ByVac Page 1 of 9

MICROCONTROLLER SYSTEM CONTROL DESIGN JON PRITCHARD SCOTT VON THUN

Dragon12 LCD Displays Huang Sections 7.8 Hantronix_CLD.PDF data sheet (Dragon12 CD-ROM) ATD_10B8C Block User Guide. Dragon12 LCD Display

UNIT 3 THE 8051-REAL WORLD INTERFACING

ARM7 TDMI Microcontroller

INTERFACING HARDWARE WITH MICROCONTROLLER

Axiom Manufacturing. Users Manual. for PROJECT DEVELOPMENT BOARD AXM xiom anufacturing

GIE 8051 Professional Kit. User Manual

MSP430. More on MSP430

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

ATMEGA32 MUSIC PLAYER

Trends in Prototyping Systems. ni logic Pvt. Ltd., Pune, India

BSCB-2 BASIC STAMP CARRIER BOARD

Department of Electronics and Instrumentation Engineering Question Bank

Getting Started in C Programming with Keil MDK-ARM Version 5

CPE 325: Embedded Systems Laboratory Laboratory #7 Tutorial MSP430 Timers, Watchdog Timer, Timers A and B

Chapter 6 Serial EEPROM by John Leung

LABORATORY MANUAL EMBEDDED SYSTEMS LABORATORY. M. Tech I Year I Sem R15 DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGG.

ASSOCIATED ELECTRONICS RESEARCH FOUNDATION C-53 PHASE-II, NOIDA

Getting Started in C Programming with Keil MDK-ARM Version 5

// Conditions for 9600/4=2400 Baud SW UART, SMCLK = 1MHz #define Bitime_5 0x05*4 // ~ 0.5 bit length + small adjustment #define Bitime 13*4//0x0D

Modules For Six Months Industrial Training On WIRELESS EMBEDDED SYSTEM DESIGN

MSP430 Interface to LMP91000 Code Library

Installation tutorial for the Skomer IDE

ARM Microcontroller Interfacing Hardware and Software

Bolt 18F2550 System Hardware Manual

Getting Started in C Programming with Keil MDK-ARM Version 5

17. I 2 C communication channel

GUJARAT TECHNOLOGICAL UNIVERSITY

Transcription:

Texas Instruments Microcontroller HOW-TO GUIDE Interfacing Keypad with MSP430F5529

Contents at a Glance PS PRIMER MSP430 kit... 3 Keypad... 4 Interfacing keypad... 4 Interfacing keypad with MSP430F5529... 5 Pin Assignment with MSP430F5529... 6 Circuit Diagram to Interface Keypad with MSP430F5529.. 7 C Program to 4 X 4 matrix keypad using MSP430F5529... 7

PS PRIMER MSP430 kit The MSP430 Primer kit is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports with Code Composer Studio v4 and later through USB port. Texas Instrument Microcontroller, MSP430 Primer Kit is proposed to smooth the progress of developing and debugging of various designs encompassing of speed 16-bit Microcontrollers. It integrates on board PS2, UART, ADC, PWM, Temperature Sensor, Relay, Buzzer, I2c Seven Segment, I 2 C Serial EEPROM, Temperature Sensor LM35, Matrix Keypad, Switch, LED, Stepper Motor Driver, Traffic Light Controller, I 2 C RTC, LCD & GLCD Display to create a stand-alone versatile test platform. User can easily engage in Primer in this platform, or use it as reference to application Primer.

Keypad A keypad is a set of buttons arranged in a block or "pad" which usually bear digits, symbols and usually a complete set of alphabetical letters. If it mostly contains numbers then it can also be called a numeric keypad. Here we are using 4 X 4 matrix keypad. Interfacing keypad The rows are connected to an output port and the columns are connected to an input port. To detect a pressed key, the microcontroller grounds all rows by providing 0 to the output latch, and then it reads the columns. If the data read from the columns is D3- D0=1111, no key has been pressed and the process continues until a key press is detected. However, if one of the column bits has a zero, this means that a key press has occurred. For example, if D3-D0=1101, this means that a key in the D1 column has been pressed.

After a key press is detected, the microcontroller will go through the process of identifying the key. Starting with the top row, the microcontroller grounds it by providing a low to row D0 only; then it reads the columns. If the data read is all 1s, no key in that row is activated and the process is moved to the next row. It grounds the next row, reads the columns, and checks for any zero. This process continues until the row is identified. After identification of the row in which the key has been pressed, the next task is to find out which column the pressed key belongs to. Interfacing keypad with MSP430F5529 We now want to scan a keypad in MSP430F5529 Primer Board. In case of 4X4 matrix Keypad both the ends of switches are connected to the port pin i.e. four rows and four columns. So in all sixteen switches have been interfaced using just eight lines.

COLUMN ROW 1Keypads arranged by matrix format, each row and column section pulled by high or low by selection J5, all row lines(p2.4 P2.7) and column lines(p2.0 to P2.3) connected directly by the port pins. Note: While using Keypad ensure all slide switches (SW20-SW27) to no connection position because the same lines used for both slide switches and matrix keypads. Pin Assignment with MSP430F5529 4x4 Matrix Lines MSP430F5529 Lines 4x4 Matrix Keypad ROW-0 P2.4 ROW-1 P2.5 ROW-2 P2.6 ROW-4 P2.7 COLUMN-0 P2.0 COLUMN-1 P2.1 COLUMN-2 P2.2 COLUMN-3 P2.3

Circuit Diagram to Interface Keypad with MSP430F5529 C Program to 4 X 4 matrix keypad using MSP430F5529 *************************************************************************************** Title : Program to keypad interfacing *************************************************************************************** #include <msp430x552x.h> #include <stdio.h> #define keyport P2OUT //Keypad Port #define COL1 (0x10 & P2IN) #define COL2 (0x20 & P2IN) #define COL3 (0x40 & P2IN) #define COL4 (0x80 & P2IN)

const unsigned char Msg1[] = "MATRIX KEYPAD "; unsigned char lsb,msb; unsigned int a=1,j=0; unsigned char key_press; unsigned char i,k,key=0; unsigned char Key_Val[] = ' ','C','8','4','0','D','9','5','1','E','A','6','2','F','B','7','3'; unsigned char get_key(void); void DelayMs(int Ms); void LCD_init(void); void LCD_cmd4(unsigned char cmd); void LCD_dat4(unsigned char byte); void main(void) unsigned int count=0; unsigned char Value=0; WDTCTL = WDTPW + WDTHOLD; // Stop WDT P6DIR = 0xF0; // Set P6.4-P6.7 to Output direction P7DIR = 0xF0; // Set P7.4-P7.7 to Output direction P2DIR = 0x0F; // Set P2.0 to 2.3 Output,Set P2.4 to 2.7 Input P2REN = 0xFF; // Set P2.0 to 2.7 Pull up Register enable P2OUT = 0xF0; // Set P2.0 to 2.7 Out Register.

P7DIR = 0xF0; P5DIR = 0xC0; P4DIR = 0x80; DelayMs(100); // Set data, P7.4-P7.7 to Output direction // Set r/w & rs,p5.6 & 5.7 to O/P direction // Set en, P4.7 to Output direction LCD_init(); DelayMs(50); LCD_cmd4(0x80); for(j=0;j<16;j++) LCD_dat4(Msg1[j]); DelayMs(5); while(1) while((count = get_key())==0); //Wait untill a key Pressed Value = Key_Val[count]; LCD_cmd4(0xC0); LCD_dat4(Value); P6OUT = ( Value << 4 );

unsigned char get_key(void) k=1; for(i=0;i<4;i++) keyport = ((0x01<<i) ^ 0xff); //Scan for a Key by sending '0' on ROWS if(!col1) //when a key pressed numbers 1--16 will be returned key = k+0; while(!col1); return key; if(!col2) key = k+1; while(!col2); return key; if(!col3) key = k+2; while(!col3); return key;

if(!col4) key = k+3; while(!col4); return key; k+=4; keyport = (0x01<<i); return 0; void DelayMs(int Ms) int k; while(ms>0) for(k=0;k<104;k++); Ms--; void LCD_init(void) LCD_cmd4(0x33); LCD_cmd4(0x22);

LCD_cmd4(0x22); LCD_cmd4(0x22); LCD_cmd4(0x28); LCD_cmd4(0x0c); LCD_cmd4(0x06); LCD_cmd4(0x01); // 28 for four bit mode void LCD_cmd4(unsigned char cmd) P5OUT = 0x00; // RW=0,RS=0 P7OUT = cmd; P4OUT = 0x80; // En = 1; P4OUT = 0x00; // En = 0; cmd = (cmd<<4) & 0xF0; P7OUT = cmd; P4OUT = 0x80; // En = 1; P4OUT = 0x00; // En = 0; DelayMs(3);

void LCD_dat4(unsigned char byte) P5OUT = 0x80; // RW=0,RS=0 P7OUT = byte; P4OUT = 0x80; // En = 1; P4OUT = 0x00; // En = 0; byte = (byte<<4) & 0xF0; P7OUT = byte; P4OUT = 0x80; // En = 1; P4OUT = 0x00; // En = 0; DelayMs(3);

Did you enjoy the read? Pantech solutions creates information packed technical documents like this one every month. And our website is a rich and trusted resource used by a vibrant online community of more than 1,00,000 members from organization of all shapes and sizes.

What do we sell? Our products range from Various Microcontroller development boards, DSP Boards, FPGA/CPLD boards, Communication Kits, Power electronics, Basic electronics, Robotics, Sensors, Electronic components and much more. Our goal is to make finding the parts and information you need easier and affordable so you can create awesome projects and training from Basic to Cutting edge technology.