This lab document outlines activities for interfacing an NxM keyboard to the 8051 microcontroller. The first activity has students create a truth table by measuring the row and column contacts for each key on the keyboard. The second activity instructs students to connect the keyboard to the 8051 as shown in a textbook and write a program to scan the keyboard, displaying pressed keys on an LCD or computer screen. Numbers will be displayed as numbers and some letters for higher keys. The third activity repeats this for a 4x4 keypad using a single port for rows and columns.
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
157 views
Lab 12B Interfacing An NXM Keyboard To The 8051
This lab document outlines activities for interfacing an NxM keyboard to the 8051 microcontroller. The first activity has students create a truth table by measuring the row and column contacts for each key on the keyboard. The second activity instructs students to connect the keyboard to the 8051 as shown in a textbook and write a program to scan the keyboard, displaying pressed keys on an LCD or computer screen. Numbers will be displayed as numbers and some letters for higher keys. The third activity repeats this for a 4x4 keypad using a single port for rows and columns.
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2
LAB 12B
INTERFACING AN NxM KEYBOARD TO THE 8051
OBJECTIVE: To interface a 4x4 keyboard (keypad) to the 8051 trainer. REFERENCE: Mazidi and McKinlay, The 8051 Microcontroller , Chapter 12. MATERIALS: MDE8051 trainer 8051 Keil Compiler 4x4 keyboard or any N x M matrix keyboard 8 of 6.8K ohms resistors ACTIVITY 1 The first step is to make a truth table for the keyboard. This truth table provides the row and column contacts by which a key is produced. Connect the ohmmeter leads, one to a row and one to a column terminal (lead) of the keyboard, and press the keys one at a time until you measure zero ohms. Repeat the process until all the keys are mapped. ACTIVITY 2 After you have mapped your keypad set, connect the keypad to the 8051 as shown in Chapter 12 of the textbook. Write and run a program that scans your keyboard and displays any character pressed by the user on the LCD (or send it to the Tera Terminal). Your program must display keys 0 - 9 as numbers 0 - 9 on the x86 PC screen while keys 10, 11, 12, 13, 14, and 15 (or you might say 0A - 0F in hex) are displayed as letters A, B, C, D, E, and F, respectively. You can modify and incorporate Program 12-1 of the textbook for your program. ACTIVITY 3 Repeat Activity 2 for 4x4 keypad and use only a single port for both rows and columns.
Lab Manual for The 8051 Microcontroller ..
LAB 12B WORKSHEET Name:
Date:
Class:
1. What is the purpose of generating the truth table for a given keyboard?
2. What is the purpose of grounding each row in keyboard interfacing?
3. What is the input to the microcontroller from column if no key is pressed?
4. True or false. In our N x M matrix keypad program we cannot press two
keys at the same time.
5. In your program in Activity 2, how is the key press detected?
6. In your program in Activity 2, how is a key press identified?