ECE 4510/5530 Microcontroller Applications Week 7

Similar documents
Keypad Interfacing. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

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

Microprocessors & Interfacing

Input/Output Devices. Lecturer: Sri Parameswaran Notes by: Annie Guo

Real Time Operating Systems Application Board Details

Texas Instruments Microcontroller HOW-TO GUIDE Interfacing Keypad with MSP430F5529

ECE 4510/5530 Microcontroller Applications Chapter 7

SC1602LC 16x2 Large Characters RS232 LCD Module. User s Manual. Large Viewing Area 99mm x 24mm. Large Character Size. 4.84mm x 9.66mm.

AN10184 Connecting a keyboard to the Philips LPC9xx microcontroller

COMP2121: Microprocessors and Interfacing. I/O Devices (II)

ECE 4510/5530 Microcontroller Applications Week 10

MICROCONTROLLER SYSTEM CONTROL DESIGN JON PRITCHARD SCOTT VON THUN

Input/Output Ports and Interfacing

Embedded Controller Programming II. I/O Device Programming in C Part 1: Input and Interrupts

Introduction to the MC9S12 Hardware Subsystems

Project 15 - Reading a keypad with the Raspberry Pi

Lab #3: Keypad Scanning in C Week of 11 February 2019

Layman definition: Gadgets and devices Technical definition: Self-controlled devices Usually, such systems consist of I/O (input/output) devices such

AN1239. HC05 MCU Keypad Decoding Techniques Using the MC68HC705J1A. Introduction

Administrivia. ECE/CS 5780/6780: Embedded System Design. Port Pull Configuration. Interfacing a Switch to a Computer

ECE 4510/5530 Microcontroller Applications Week 9

ADSmartIO Driver Specification for Windows CE

Hello and welcome to this Renesas Interactive module that covers the Independent watchdog timer found on RX MCUs.

Magic 8 Ball. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name

CS/ECE 5780/6780: Embedded System Design

ELEC 3040/3050 Lab 5. Matrix Keypad Interface Using Parallel I/O

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

ELEC 3040/3050 Lab 5. Matrix Keypad Interface Using Parallel I/O

Programming and Interfacing LCD Key Switches

Introduction to Micro-controllers. Anurag Dwivedi

Chapter 9. Input/Output (I/O) Ports and Interfacing. Updated: 3/13/12

RTC Interface 89C51 DS M. Krishna Kumar MAM/M7/LU17/V1/ Vcc VCC 5 SDA P1.0 6 SCL P KHz 3 BAT 3.

Introduction to Embedded Systems

LCD. Configuration and Programming

Laboratory 1 Introduction to the Arduino boards

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

LCD AND KEYBOARD INTERFACING

ARM HOW-TO GUIDE Interfacing Keypad with LPC2148 ARM

ECE3120: Computer Systems Chapter 7: Interfacing I/O Devices Lab-Class

ECE 353 Lab 4. General MIDI Explorer. Professor Daniel Holcomb Fall 2015

F²MC-16FX FAMILY MB96340 KEY MATRIX INTERFACE USING I/O PORT 16-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

Pager Controlled Universal VCR Programmer (PCUVP) Senior Design Project By Jeff Shudark Fall Advising Professor: Dr.

App Note Application Note: State-Driven Control of a dpasp using a Microchip PIC.

ECE 372 Microcontroller Design

The IIC interface based on ATmega8 realizes the applications of PS/2 keyboard/mouse in the system

Microprocessor and Microcontroller question bank. 1 Distinguish between microprocessor and microcontroller.

AN1745. Interfacing the HC705C8A to an LCD Module By Mark Glenewinkel Consumer Systems Group Austin, Texas. Introduction

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

*** All this without using a single GPIO digital I/O pin ***

EE 308 Spring 2013 The MC9S12 A/D Converter

Fujitsu Microelectronics Europe Application Note MCU-AN E-V10 F²MC-FR FAMILY 32-BIT MICROCONTROLLER MB91460 RELOAD TIMER APPLICATION NOTE

Software debouncing of buttons

ARM HOW-TO GUIDE Interfacing Switch with LPC2148 ARM

Write LED display data, in accordance with the address from the display from low to high, from low to high data byte operation.

C Language Programming, Interrupts and Timer Hardware

Lab Overview. Lab Details. ECEN 4613/5613 Embedded System Design Week #7 Spring 2005 Lab #4 2/23/2005

Microcontroller Introduction

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

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

ECE 4510/5530 Microcontroller Applications Week 12

C Language Programming, Interrupts and Timer Hardware

Chapter 11: Interrupt On Change

Integer Representation

Interfacing Z8 Encore! XP MCUs with an I 2 C-Based Character LCD

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

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly.

CprE 288 Introduction to Embedded Systems (Timers/Input Capture) Instructors: Dr. Phillip Jones

ECE 4510 Introduction to Microprocessors. Software Review

Bachelor of Engineering in Computer and Electronic Engineering

Department of Electronics and Instrumentation Engineering Question Bank

F²MC-8FX FAMILY MB95200H/210H SERIES HOW TO USE DBG PIN 8-BIT MICROCONTROLLER APPLICATION NOTE

C:\Users\jacob\Documents\MtSAC\ELEC74 Mt SAC - chipkit\homework Sheets.docx

Interrupt vectors for the 68HC912B32. The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF.

EE 308 Spring A software delay

Part 1 Connecting the Chips In your parser project add a new tab named "LCD.h" Copy this code into that tab //1// #include <QuickTypes.

Using Input Capture on the 9S12

F²MC-8FX FAMILY MB95200H/210H SERIES HOW TO USE DBG PIN 8-BIT MICROCONTROLLER APPLICATION NOTE

Matrix Manipulation Using High Computing Field Programmable Gate Arrays

Interconnects, Memory, GPIO

8051 Microcontroller

Lab 3 LCD Mar

ECE 4510/5530 Microcontroller Applications Week 6

LED Pacman. Final Project Report December 4, 2017 E155. Kai Kaneshina and Gabriel Quiroz. Abstract :

The MC9S12 Timer Output Compare Function Making an event happen at specific time on the HC12 The MC9S12 Output Compare Function

Using the HT16K33 in DVD Player Panel Applications

Programming the keys

Using peripherals on the MSP430 (if time)

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

ME 6405 Introduction to Mechatronics

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

538 Lecture Notes Week 1

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

MICROPROCESSORS A (17.383) Fall Lecture Outline

#include <avr/io.h> #include <avr/interrupt.h> #define F_CPU UL // 8 MHz.h> #include <util/delay.h>

Administrivia. ECE/CS 5780/6780: Embedded System Design. Debugging: Another perspective. Testing & Stabilization

EXPERIMENT NO. 01 CALCULATOR USING PIC16F877

Homework 5: Theory of Operation and Hardware Design Narrative

Welcome to this presentation of the STM32 direct memory access controller (DMA). It covers the main features of this module, which is widely used to

8051 I/O and 8051 Interrupts

COMP2121: Microprocessors and Interfacing. I/O Devices (I)

Transcription:

45/553 Microcontroller Applications Week 7 Dr. Bradley J. Bazuin Associate Professor Department of Electrical and Computer Engineering College of Engineering and Applied Sciences

MISC Stuff Keypad revisited 25 2

Optional Required Reading Reminiscences of the VLSI Revolution: How a series of failures triggered a paradigm shift in digital design By Lynn Conway IEEE SOLID-STATE CIRCUITS MAGAZINE, vol.4, no.4, pp.8-3, Dec. 22 http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=639323 45/553 3

Keypad Revisited 45/553 4

6-Button Keypad 42 Series by C&K Components, Inc. Web Site: www.ckcorp.com Matrix connections based on which key is pressed Time multiplex pins -4 while reading pins 5-8 A keypad controller IC can be purchased to act as a peripheral 25 5

6-Button Keypad Series 96 by Grayhill, Inc. Web Site: www.grayhill.com Matrix connections based on which key is pressed Time multiplex pins -4 while reading pins 5-8 A keypad controller IC can be purchased to act as a peripheral 25 6

Text Keypad Circuitry PA7 PA6 PA5 PA4 Selected keys HCS2 MCU PA7, 4, 8, C,, 5, 9, D, 2, 6, A, E, and 3 and 7 and B and F Table 7.6 Sixteen-key keypad row selections outputs PA6 PA5 PA4 PA3 3 7 B F inputs PA2 PA 2 6 5 A 9 E D PA 4 8 C K V CC 25 7 Figure 7.4 Sixteen-key keypad connected to the HCS2

Text Keypad Scanning Keypad scanning is usually performed row-by-row or column-by-column A 6-key keypad can be easily interfaced using any available 8-bit I/O port For the keypad application the upper four pins of the port should be configured for output and the lower four pins of the port should be configured for input (with pull-ups) The rows and columns of a keypad are simply conductors The keypad interface setup to HCS2 PortA is as shown in the next slide 25 8

Text Keypad Operation Whenever a key switch is pressed, the corresponding row and column are shorted together In order to distinguish the row and column of the key pressed Scan a zero through the columns If an input row becomes zero, the key pressed must be connected to the zeroed column. Figure it out to determine the key! PA7 PA6 PA5 PA4 Selected keys, 4, 8, C,, 5, 9, D, 2, 6, A, E, and 3 and 7 and B and F Table 7.6 Sixteen-key keypad row selections 25 9

Class Keypads 45/553

Keypad Input vs. Key Pressed (When PA7-PA not all s) Key PA7 PA6 PA5 PA4 PA3 PA2 PA PA Key Driven Outputs Inputs Value 7 2 4 3 4 F 5 8 6 5 7 2 8 E 9 9 A 6 B 3 C D D C E B F A 25

Text Keypad Code Function # define keypad PTA # define keypad_dir DDRA char getkey (void) char rmask, cmask, row, col; char temp, keycode; keypad_dir = xf; keypad = xf; while () rmask = xef; for (row = ; row < 4; row++) cmask = x; keypad = rmask; } } } // configure lower four pins for input // write upper four pins // select the current row for (col = ; col < 4; col++) if (!(keypad & cmask)) // key switch detected pressed delaybyms(); if(!(keypad & cmask)) // check the same key again keycode = row * 4 + col; if (keycode < ) return (x3 + keycode); else return (x37 + keycode); } } cmask = cmask << ; } rmask = (rmask << ) xf; // sequence of xef, xdf, xbf and x 7F 45/553 2

Rethinking the Function # define keypad PORTA # define keypad_dir DDRA char getkey(void) char key_array[4][4] =, 7, 4,, 5, 8, 5, 2, 4, 9, 6, 3, 3, 2,, }; char rmask, cmask, row, col; } cmask = xef; // init keypad scan for col = ; col < 4; col++) // rmask = x; keypad = cmask; // Test the th row for (row = ; row < 4; row++) if (!(keypad & rmask)) // key switch detected pressed keypad = xff; // standby keypad values return (key_array[col][row]); } rmask = rmask << ; } cmask = (cmask << ) xf; // sequence of xef, xdf, xbf and x 7F } keypad = xff; // standby keypad values return (xff); 45/553 3

Keypad Main Code If getkey() is called If a key is pressed, the value If a key is not pressed, xff There is no debouncing Requirements Debounce delay checking Create some type of count with a threshold test Only accept key when it is released Place the key value in a key-press buffer to be operated on Save the value at a pointer location to an array Provide a status flag of the keypad operational state Key being pressed, not yet valid Key being pressed, delay is long enough Key value received and is valid Initialize interface and all variables as needed 45/553 4

Keypad Main Code while() // Do something here asm("nop"); // Key scanning designed for every while loop // Looking for the key to be pressed and released // if(check_keypad_flag) current_key = getkey(); // retrieve a key value if(last_key <> xff) key_count++; // count the key press loops key_status = x; // status is x invalid press if(key_count>key_thresh) // accept if greater key_status = x2; // status is x2 valid press if(current_key == xff) key_status = x3; // status is x3 saved value *key_ptr++ = last_key; } } } else key_count = ; key_status = x; } last_key = current_key; } } } 45/553 5

Keypad Main Code Misc # define keypad PORTA # define keypad_dir DDRA # define KEY_THRESH void main(void) int char char char char int ii; check_keypad_flag; key_status, last_key, current_key; key_input[]; *key_ptr; key_count; 45/553 COPCTL=x; asm("sei"); // Initilize keypad and key variables keypad_init(); // set up port pins last_key = xff; key_count = ; key_status = x; key_ptr = &key_input[]; for(ii=; ii<;ii++) // initilize key_input key_input[ii]=; } asm("cli"); 6

Rethinking Code Although you have completed previous labs. It may be useful to review what has previously done so that is more useful for current or future labs. Is your keypad useful for inputting a string of numbers or hex digits? DAC output defined by keypad. If the four function calculator is Project #2. Can similar concepts be applied to the 5x7 display? 45/553 7