1 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs.

Slides:



Advertisements
Similar presentations
EMS1EP Lecture 6 Digital Inputs
Advertisements

1 ECE 372 – Microcontroller Design Parallel IO Ports - Outputs Parallel IO Ports E.g. Port T, Port AD Used to interface with many devices Switches LEDs.
8051 I/O Interfacing Need for more ports PPI 8255
Programmable Interval Timer
Programmable Keyboard/ Display Interface: 8279
Input/Output (I/O) Ports and Interfacing
Input/Output Ports and Interfacing ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
82C55 82C55 Programmable Peripheral Interface Interfacing Part III.
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 12.
Mark Neil - Microprocessor Course 1 Decoding and Using a 4x4 Keyboard.
Debouncing Switches Mechanical switches are one of the most common interfaces to a uC. Switch inputs are asynchronous to the uC and are not electrically.
Spring EE 316 Computer Engineering Junior Lab Designing State machines for a numeric Keypad.
Motor Control of an Oscillating Pendulum Nick Myers and Chirag Patel March 9, 2004 Advised by: Dr. James Irwin and Mr. Jose Sanchez Bradley University.
Embedded Systems Design 1 Lecture Set B Interfacing the MCS-51 to: –7 and 16 segment displays –a Multiplexed 7-Segment Display –a Keypad –an LCD.
Lecture – 7 Basic input and output
ECE 447 Fall 2009 Lecture 6: TI MSP430 IO Interfacing.
ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing.
ECE 353 Introduction to Microprocessor Systems Michael Schulte Week 12.
ENGR 355 Take Home Lecture 2 WRITING CODE Introductory Comments /* Disgruntled Avians Lab 6 ENGR355 by Tim Kyle Rev /1/2014 LM-3551 Tilt Sensor.
 Keyboards, LCDs most widely used input/output devices of the 8051  Contents to be covered:  keyboard fundamentals  key press and key detection mechanisms.
Revised: Aug 1, EE4390 Microprocessors Lessons 29, 30 Welcome to the Real World!
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
Dr. Rabie A. Ramadan Al-Azhar University Lecture 6
Input/Output Ports and Interfacing
Homework Assignment 3 Due date: Tuesday, Wednesday, or Thursday, October 4-6, 2005 input: push-button switch output: seven-segment LED 7 points Menu System.
I/O devices Peripheral devices (also called I/O devices) are pieces of equipment that exchange data with a CPU Examples: switches, LED, CRT, printers,
COMP3221: Microprocessors and Embedded Systems Lecture 18: Computer Buses and Parallel Input/Output (II) Lecturer: Hui.
Khaled A. Al-Utaibi  The Push Button  Interfacing Push Buttons to Arduino  Programming Digital Inputs  Working with “Bouncy”
10/24/2015 Amrita Vishwa Vidyapeetham 1 Key Board & LED Interfacing.
Lecturers: Professor John Devlin Mr Robert Ross
© 2000 Morgan Kaufman Overheads for Computers as Components I/O devices  I/O devices:  serial links  timers and counters  keyboards  displays  analog.
University of Houston ECE 5440/6370 Advanced Digital Design Lecture on Debouncing Circuit Yuhua Chen Spring 2010.
Engineering 1040: Mechanisms & Electric Circuits Winter 2015 Interfacing Light-Emitting Diodes (LEDs) & Push Buttons to Microcontrollers.
8279 KEYBOARD AND DISPLAY INTERFACING
Parallel Interfacing Chapter 7. Parallel Interfacing Parallel I/O Ports Using Parallel Ports Seven-Segment Displays Keypad Interfacing Liquid Crystal.
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
Interrupts Microprocessor and Interfacing
Microprocessor and Interfacing Example: Writing a Game Need to Check Keyboard Input.
8279 KEYBOARD AND DISPLAY INTERFACING
EE 316 Computer Engineering Junior Lab Project 2 Digital Yahtzee.
CSCI1600: Embedded and Real Time Software Lecture 9: Input Output Concepts Steven Reiss, Fall 2015.
Interfacing to External Devices  Explore Digital Interfaces techniques  Introduce some complex optical devices and how to interface them  Describe methods.
Water Flow GROUP A. Analogue input voltage results: Motor Input voltage( V) pin 12 Analogue input voltage (V) Display number
CSCI1600: Embedded and Real Time Software Lecture 16: Advanced Programming with I/O Steven Reiss, Fall 2015.
Parallel I/O. Introduction This section focuses on performing parallel input and output operations on the 68HC11 3 operation types – Simple, blind data.
KEYBOARD INTERFACING Keyboards are organized in a matrix of rows and columns The CPU accesses both rows and columns through ports. ƒTherefore, with two.
Alpha/Numeric Keypad Functions using AVR Preliminary Design Review Luke R. Morgan ECE /17/2008.
Lecture 4 General-Purpose Input/Output NCHUEE 720A Lab Prof. Jichiang Tsai.
Interrupts Microprocessor and Interfacing
ECE 447: Lecture 12 Keypads ECE 447: Lecture 10. ECE 447: Matrix Keypad.
Microprocessors A practical approach..
BIRLA VISHVAKARMA MAHAVIDYALAYA TOPIC : Keyboard interfacing and flowchart MADE BY: Nidhi Bhangale ( ) Gargi Patel ( ) Meghna Rathod.
Launchpad with MIDI TAHA SHASHTARI MAHMOUD AL-SHAKA’A.
Mobile phone keypad sensed password entry for door opening.
Peripherals – Keypad The Keypad provides a simple means of numerical data or control input. The keys can be attributed whatever data or control values.
LCD AND KEYBOARD INTERFACING
Input/Output Ports and Interfacing
Microcontroller Based Digital Code Lock
Lecture 6: TI MSP430 IO Interfacing
DIGITAL CALCULATOR USING 8051
Subject Name: Microprocessors Subject Code:10EC46 Department: Electronics and Communication Date: /10/2018.
Keypad Source: under under
CSCI1600: Embedded and Real Time Software
82C55 Programmable Peripheral Interface
Keypad Source: under under
Keypad Source: under under
Robocon 2007 Electronics Quickstart!
CSCI1600: Embedded and Real Time Software
LCD AND KEYBOARD INTERFACING
Presentation transcript:

1 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs

2 Button Inputs - Bounce Problem We want to recognize this as a single press of the switch rather than multiple presses as indicated in the voltage diagram Solutions: Some expensive switches do not bounce We can debounce switches with hardware We can debounce switches with software

3 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Hardware De-bouncing Use hardware to de-bounce button presses Button/Switch bounce removed using capacitor and Schmitt Trigger Why is this a bad circuit? Inverter with Schmitt Trigger

4 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Hardware De-bouncing Use hardware to de-bounce button presses Button/Switch bounce removed using capacitor and Schmitt Trigger Switch/button touch/press removed by capacitor Switch/button release also removed by capacitor

5 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Hardware De-bouncing Choose capacitor value large enough such that the inverter input does not exceed 0.7V threshold. If this exceeds the input threshold, we will not have de-bounced the switch/button

6 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Hardware De-bouncing Resistance of contact is 0.1Ω Instantaneous current when switch closes is large enough to cause a spark Will shorten life of your button

7 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Hardware De-bouncing Good hardware de-bounce implementation Limit instantaneous current to avoid sparks

8 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Software De-bouncing De-bounce switch/button using software code on your microcontroller No additional hardware required Steps: Wait for key to be presses Delay 10 ms (should be longer than expected bounce time) Wait for key to be released Delay 10 ms

9 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Software De-bouncing Flowchart for software code Software de-bounce for button press Software de-bounce for button release

10 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Software De-bouncing for Button Press - Assembly waitPressldda PORTT ;wait for press anda #$01 bne waitPress ldd DELAY ;wait 10ms loopdecd bne loop rts Assembly Code:

11 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Software De-bouncing for Button Press - Assembly void waitPress(void) { while (PORTT & 0x01); /*wait for press*/ for(i=0; i<DELAY; i++); /* delay */ } C Code:

12 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Software De-bouncing for Button Release - Assembly waitRelease ldaa PORTT anda #$01 beq waitRelease ldd DELAY loopdecd bne loop rts Assembly Code:

13 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Software De-bouncing for Button Release - Assembly void waitforrelease(void) { while(!(PORTT & 0x01)); for(i=0; i<DELAY; i++); } C Code:

14 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Software De-bouncing Timing is not very accurate How can we better code the subroutines? Use internal timer (TCNT)

15 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Software De-bouncing Alternative simple software de-bouncing Read switch/button until you read the same value twice

16 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Keypads Collection of several keys grouped into a single device Can buy keypads in many different configurations Build your own keypad using individual buttons How can we read dozens of keys on the keypad without requiring dozens on individual input ports on our microprocessor? Hint: It’s similar to how we can interface with dozens of outputs using only a few pins

17 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Keypads

18 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Keypad Scanning Similar to scanning for controlling multiple output LEDs Scan the keys one row at a time and read the column lines to see if any key on that row were pressed

19 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Keypad Scanning Similar to scanning for controlling multiple output LEDs Scan the keys one row at a time and read the column lines to see if any key on that row were pressed Set each row output sequentially to output 0 2. Check column inputs to see if key was pressed What if this key is pressed?

20 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Keypad Scanning Similar to scanning for controlling multiple output LEDs Scan the keys one row at a time and read the column lines to see if any key on that row were pressed Set each row output sequentially to output 0 2. Check column inputs to see if key was pressed No key pressed on first row

21 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Keypad Scanning Similar to scanning for controlling multiple output LEDs Scan the keys one row at a time and read the column lines to see if any key on that row were pressed Set each row output sequentially to output 0 2. Check column inputs to see if key was pressed No key pressed on first row

22 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Keypad Scanning Similar to scanning for controlling multiple output LEDs Scan the keys one row at a time and read the column lines to see if any key on that row were pressed Set each row output sequentially to output 0 2. Check column inputs to see if key was pressed Key press detected in second column

23 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Keypad Scanning Similar to scanning for controlling multiple output LEDs Scan the keys one row at a time and read the column lines to see if any key on that row were pressed Set each row output sequentially to output 0 2. Check column inputs to see if key was pressed No key pressed on first row

24 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Keypad Multiplexing Could also use keypad multiplexing Enable each row one at a time by outputting the row address to the decoder input Decoder will enable only one row Use encoder to read key press and output column address of keypress to microcontroller + 5V

25 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Keypad Multiplexing – Challenges Can one handle one key press at a time How do we recognize the when no keys are pressed? + 5V

26 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs Keypad Multiplexing Need an encoder to provide the column address of the key that was pressed Can use the output E0 of the following encoder to detect if no key are pressed

27 ECE 372 – Microcontroller Design Parallel IO Ports - Outputs Mill Game

28 ECE 372 – Microcontroller Design Parallel IO Ports - Outputs Mill Game 3 Rows 8 Columns