DOC PREVIEW
U of U CS 5780 - LAB 5 - Keypad Interface Using Interrupts

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

ObjectivesReadingBackgroundPartsSoftwareTasksPrelabWriteupCS/ECE 5780/6780 Lab #5Spring 2009RegehrLAB #5: Keypad Interface Using InterruptsLab writeup is due to your TA at the beginning of your next scheduled lab. Don’t put this off to the lastminute! There is pre-lab work to complete before the start of the next lab. NO LATE LAB REPORTSWILL BE ACCEPTED.1 Objectives• Redesign the hardware and software interface between a keypad and a microcomputer using inter-rupts.2 Reading• Read Chapter 4.• Read section 8.1 about keyboard scanning and debouncing.3 BackgroundIn this lab, you will redesign the keypad interface from the last lab using interrupt synchronization. Thereare two advantages to interrupts in this application. First, placing keypad input into a background thread,allows the main program to execute other tasks while waiting for key entries. Second, interrupts givethe ability to create accurate and bounded interface delays. First, you can use real-time interrupts toimplement periodic polling. Second, you can read ahead (Section 6.1) and use input capture. Third, youcan read ahead (Section 6.2) and use output compare periodic polling. The choice is yours.4 PartsDepending on how you choose to implement the interrupt, you may need some external logic gates whichare available in the ECE lab for purchase.5 SoftwareBelow is a prototype for your keypad device driver:1. Data structures: global, private (accessed only by device driver, not the user)OpenFlag - Boolean that is true if the keyboard port is open, initially false, set to true by KeyOpen, setto false by KeyClose, should be in static storage.Fifo - FIFO queue with Clr, Put, and Get operations.Lab #5, Page 22. Initialization routines (called by user)KeyOpen - Initialization of the keyboard port, sets OpenFlag to true, initializes the hardware, returnserror code if unsuccessful (hardware non-existent, already open, etc.), no input parameters, outputparameter is error code.KeyClose - release of keyboard port, sets OpenFlag to false, returns error code if not previouslyopen.3. Regular I/O calls (called by user to perform I/O)KeyIn - input an key value from the keyboard port, tries to Get a byte from the Fifo, returns data ifsuccessful, returns error code if unsucessful (device not open, Fifo empty, etc.).4. Support software (private, not directly accessible by the user)There is one interrupt service handler: KeyHan which should occur either every 20 ms (if periodicpolling is used) or whenever a key is detected (if a hardware interrupt is used). It should scan thekeypad. It may also debounce, and deal with 1 or 2 key rollover.6 Tasks1. Prepare a schematic for your design including all components (note, you will need pull-up resistorson all the keypad inputs).2. Rewrite your low-level keypad device driver using interrupts.3. Combine your security code access program with a program that counts on the Project Board LEDs3-7 at a discernible rate. In other words, your security system should count on LEDs, but it shouldaccept a security code when there are key presses.4. Connect your circuit and debug your software. Check-off your working circuit with your TA.7 PrelabYou should complete the first 3 tasks before your lab section.8 Writeup1. Your hardware schematic.2. A description of which interrupt method you used and why.3. A description of the tasks accomplished in your KeyHan function and why they were included (maybewhy other functionality was excluded).4. A printout of your C


View Full Document

U of U CS 5780 - LAB 5 - Keypad Interface Using Interrupts

Documents in this Course
Lab 1

Lab 1

5 pages

FIFOs

FIFOs

10 pages

FIFOs

FIFOs

5 pages

FIFO’s

FIFO’s

12 pages

MCU Ports

MCU Ports

12 pages

Serial IO

Serial IO

26 pages

Load more
Download LAB 5 - Keypad Interface Using Interrupts
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LAB 5 - Keypad Interface Using Interrupts and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LAB 5 - Keypad Interface Using Interrupts 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?