Recent Changes - Search:

Introduction to Microcontroller Programming

About PICmicro Chips

Clocking Your PICmicro Devices

E-Blocks

Flowcode Step By Step

PICmicro Projects

Labs

Lab 9 - Keypad

<^< 8. LCD | Course Index | 10. Analogue + EEPROM >^>

1. Introduction

A numeric keypad is used in many electronic devices. The most commonly used is probably your cell phone where it is used both as a numeric keypad and as a way to type text instead of numbers.

2. Setting up the equipment
3. Hardware settings
EB006 OptionsSettingJumper settings (EB006)Jumper settings (HP488)
Power supplyExternal, 14VJ29: PSUJ29: PSU
PICmicro device16F1937  
Programming methodUSBJ12,13,14: USBJ20: USB
Clocking methodXTALSW2: XTALS2: XTAL
R/C clock speed   
Xtal frequency19 660 800 Hz  
LVP Jumper selectionI/O PortJ11,16,17: I/O PortJ15,16,18: I/O
Port A E-block   
Port B E-blockLED board  
Port C E-blockLCD board  
Port D E-blockKeypad board  
Port E E-block   
4. Flowcode and download settings
Build > Project Options... > General Options Build > Project Options... > Configure
OptionsSetting
Clock speed19 660 800 Hz
Simulation speed10
OptionsSetting
Device16F1937
RC/XTXTAL
Watchdog timerOff
5. Software learning objectives

Input, output, binary code training, using a hardware macro (Keypad), working with text, working with the ASCII table, what a hardware macro is exactly?

6. Hardware learning objectives

LED’s, Logic output levels, LCD, How a numeric keypad works, Multiplexed inputs.

7. Instructions

Construct the system shown from E-blocks.

In the course navigate to the ‘Flowcode step-by-step’ and review the section on The LCD Display (step 5) and the section on Strings and memory (step 11). The descriptions of the Multiprogrammer board , the keypad board, the LCD and the led board are in the E-blocks section.

Look into the 'Help' menu and function in Flowcode to get the info you need.

There are 12 buttons on the keypad and the keypad is connected to the PIC by only 8 lines. This problem is solved by using multiplexing.

8. Labs
Letter Meaning
L Lab x
B Basic complexity
I Intermediate complexity
E Expert complexity
L9-B1
Display the number that is pressed on the Keypad, on the LCD. Leave it on the LCD for as long as the button on the keypad is pressed. The LCD should only show one number at a time. Download this program to the PIC and test it.
L9-I2
Do the same task as in L9-B1, but now without using the Keypad hardware Macro. Download this program to the PIC and test it.
L9-B3
Display the numbers that are pressed on the Keypad, on the LCD, one after the other. Use the character * for a space and when # is pressed, the LCD should be cleared. Limit the maximum number of characters on the LCD to 15. Display a warning text on line 2 of the LCD when this number gets exceeded. Download this program to the PIC and test it.
L9-E4
Make a simple adding calculator with the Keypad and the LCD. The 2 numbers that are added can not be greater than 9999. Display an error message on line 2 if this occurs. * should be used for ‘+’ and # should be used for ‘=’. The 2 numbers, the ‘+’, the ‘=’ and the result should be displayed all together on line one of the LCD. Download this program to the PIC and test it.
L9-B5
Make a simple game where a player needs to guess a number between 0 and 9. The secret number is pre-programmed in the PIC. If the guessed number isn’t correct, then the LCD displays a message on line 2 with the info if the secret number is bigger or smaller than the number guessed by the player. Use * and # as you want to make this game. The keypad should be used as an input device for the numbers, the LCD should be used as the output device. Line 1 of the LCD should display the last input of the Keypad. Download this program to the PIC and test it.
L9-I6
Make a more complex game where a player needs to guess a number between 0 and 255. The secret number is pre-programmed. If the guessed number isn’t correct, then the LCD should display a message on line 2 with the info if the secret number is bigger or smaller than the number guessed by the player. Use * and # as you want to make this game. The keypad is used as an input device for the numbers, the LCD is the output device. Line one of the LCD should display the last input of the Keypad. Download this program to the PIC and test it.
L9-I7
Make an even more complex game where a player needs to guess a number between 0 and 9999. The secret number is pre-programmed. If the guessed number isn’t correct, then the LCD displays a message on line 2 with the info if the secret number is bigger or smaller than the number guessed by the player. Use * and # as you want, to make this game. The keypad is used as an input device for the numbers, the LCD is the output device. Line 1 of the LCD should display the last input of the Keypad. Download this program to the PIC and test it.
L9-E8
Use the keypad as it is used on your cell phone to input a text to the PIC. This text is shown on the LCD. * stands for a space and when # is pressed, the LCD needs to be cleared. Make use of the ASCII table to do this task. A text message can not be longer that 10 characters. Display a warning text on line 2 of the LCD when this number gets exceeded. Download this program to the PIC and test it.
L9-I9
Draw up the full circuit diagram of the PIC with 8 LEDs on port B, the LCD on port C and the Keypad on port D, including the clocking circuit, the reset circuit, VDD and VSS connected to the PIC and the correct current limiting resistors connected between LEDs and the PIC. If you were to make a practical circuit of this drawing, and connect power to it, it should behave exactly the same as the e-blocks system in front of you. Schematics in the E-blocks section and the full circuit diagrams in the datasheets of the E-blocks will come in handy when you do this task.

<^< 8. LCD | Course index | 10. Analogue + EEPROM >^>

Print - Search - Login

Page last modified on May 13, 2013, at 03:36 PM