Ini adalah tugas ke empat yang diberikan oleh dosen mikrokontroler. Didalamnya membahas tentang fungsi dari keypad (keypad matriks maupun DTMF), dan hubungannya dengan mikrokontroler.Deskripsi lengkap
CGEFull description
Infome del laboratorio 4 del curso de Hidraulica de canales dictado en la Pontificia Universidad Catolica del Peru.Descripción completa
Lab 4, Calculus 1
NetworkFull description
Fuerzas de presion sobre superficies planasDescripción completa
Descripción completa
GMS 4.06 Web Client - Operator GuideDescripción completa
Descripción: Arduino servomotores TEC Bol
Wireshark Lab
Lab Notes 4 PIC16F877: KEYPAD LCD
Mechatronics Lecture Notes by Dr. Can U. Dogruer
L4. PIC16F877:KEYPAD LCD INTERFACING Objectives 1. Interface LCD 2. Learn how to LCD library of mikroC PART LIST NO 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 3.
PART NAME PIC16F877 / PIC16F877A Push Button 10K Resistor Keypad (4x4) LCD (16x2) Potentiometer MAX232 1-micro Farad Polarized Capacitor RS-232 Connector RS-232 Cable 20 MHz Crystal 22-picoFarad Capacitor Copper Wire USB PIC Programmer [Hardware] PIC Downloader Program [Bootloader; Software]
QUANTITY 1 1 9 1 1 1 1 5 1 1 1 2 2 meter 1 1
L10.1 EXPERIMENT V: KEYPAD LCD INTERFACING In this experiment you will interface a keypad to a PIC microcontroller. This experiment is an extension of the previous week LCD interfacing application. You have to preserve the LCD interfacing circuit and only connect the keypad to PORTB. Note that you need to attach pull-down resistor of 10K to each keypad pins. NOTE: STUDY LCD AND KEYPAD LIBRARY HELP FILES
Hacettepe University / Mechanical Engineering Department Automotive Engineering Program
L4-1
Lab Notes 4 PIC16F877: KEYPAD LCD
Mechatronics Lecture Notes by Dr. Can U. Dogruer
Hacettepe University / Mechanical Engineering Department Automotive Engineering Program
Construct the circuit shown in Figure 1. Note that pins of keypad is attached to pull-down resistors of 10K In this experiment keypad is interfaced to PORTB so Write a C code that display text on LCD display
// Keypad module connections char keypadPort at PORTB; // End Keypad module connections // LCD module connections sbit LCD_RS at RC4_bit; sbit LCD_EN at RC5_bit; sbit LCD_D4 at RC0_bit; sbit LCD_D5 at RC1_bit; sbit LCD_D6 at RC2_bit; sbit LCD_D7 at RC3_bit;
sbit LCD_RS_Direction at TRISC4_bit; sbit LCD_EN_Direction at TRISC5_bit; sbit LCD_D4_Direction at TRISC0_bit; sbit LCD_D5_Direction at TRISC1_bit; sbit LCD_D6_Direction at TRISC2_bit; sbit LCD_D7_Direction at TRISC3_bit; // End LCD module connections
void main() { cnt = 0;
// Reset counter
Hacettepe University / Mechanical Engineering Department Automotive Engineering Program
L4-3
Lab Notes 4
Mechatronics Lecture Notes by Dr. Can U. Dogruer
PIC16F877: KEYPAD LCD Keypad_Init();
// Initialize Keypad
Lcd_Init();
// Initialize LCD
Lcd_Cmd(_LCD_CLEAR);
// Clear display
Lcd_Cmd(_LCD_CURSOR_OFF);
// Cursor off
Lcd_Out(1, 1, "1"); Lcd_Out(1, 1, "Key :");
// Write message text on LCD
Lcd_Out(2, 1, "Times:");
do { kp = 0;
// Reset key code variable
// Wait for key to be pressed and released do // kp = Keypad_Key_Press(); kp = Keypad_Key_Click();
// Store key code in kp variable // Store key code in kp variable
while (!kp); // Prepare value for output, transform key to it's ASCII value switch (kp) { //case 10: kp = 42; break; // '*' // Uncomment this block for keypad4x3 //case 11: kp = 48; break; // '0' //case 12: kp = 35; break; // '#' //default: kp += 48;
case 1: kp = 49; break; // 1
// Uncomment this block for keypad4x4
case 2: kp = 50; break; // 2 case 3: kp = 51; break; // 3 case 4: kp = 65; break; // A case 5: kp = 52; break; // 4 case 6: kp = 53; break; // 5 case 7: kp = 54; break; // 6 case 8: kp = 66; break; // B
Hacettepe University / Mechanical Engineering Department Automotive Engineering Program
L4-4
Lab Notes 4 PIC16F877: KEYPAD LCD
Mechatronics Lecture Notes by Dr. Can U. Dogruer
case 9: kp = 55; break; // 7 case 10: kp = 56; break; // 8 case 11: kp = 57; break; // 9 case 12: kp = 67; break; // C case 13: kp = 42; break; // * case 14: kp = 48; break; // 0 case 15: kp = 35; break; // # case 16: kp = 68; break; // D }