LABORATORY MANUAL Interfacing LCD 16x2, Keypad 4x4 and 7Segment Display to PIC18F4580

Similar documents
LCD. Configuration and Programming

INTERFACING 16 2 LCD WITH 8051

RFID: Read and Display V2010. Version 1.1. Sept Cytron Technologies Sdn. Bhd.

Input/Output Ports and Interfacing

DEV-1 HamStack Development Board

Display Real Time Clock (RTC) On LCD. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

CLCD1 Serial 1 wire RS232 LCD development board

SK40C ENHANCED 40 PINS PIC START-UP KIT. User s Manual V1.3. March 2012

PIC 28 Pin Board Documentation. Update Version 5.0

Chapter 9. Input/Output (I/O) Ports and Interfacing. Updated: 3/13/12

Applications of 8051 Microcontrollers

Laboratory 10. Programming a PIC Microcontroller - Part II

Tic-Tac-Toe with mtouch. Version 1.0. June Cytron Technologies Sdn. Bhd.

LCD MODULE 1x mm INCL. CONTROLLER HD 44780

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interfacing External Devices using Embedded C Module No: CS/ES/22

LCD MODULE 4x mm INCL. CONTROLLER SSD1803

Engr. A. N. Aniedu Electronic and Computer Engineering Nnamdi Azikiwe University, Awka

Dual Interface LCD Display Controller

Lecture (09) PIC16F84A LCD interface LCD. Dr. Ahmed M. ElShafee

中显液晶 技术资料 中显控制器使用说明书 2009年3月15日 北京市海淀区中关村大街32号和盛大厦811室 电话 86 010 52926620 传真 86 010 52926621 企业网站.zxlcd.com

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

SLCD1-IC Serial LCD Processor

AN1745. Interfacing the HC705C8A to an LCD Module By Mark Glenewinkel Consumer Systems Group Austin, Texas. Introduction

LCD AND KEYBOARD INTERFACING

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6

LABORATORY 1 INTRODUCTION TO 8085 MICROPROCESSOR DEVELOPMENT SYSTEM BOARD

EXPERIMENT 4: Parallel Input/Output. Objectives Introduction to the Parallel Input/Output (I/O) Familiarization to Interfacing

The FED PIC Flex 2 Development Boards

EE389 EDL Report, EE Deptt., IIT Bombay, Nov RF linked Handheld Terminal

BV4218. I2C-LCD & Keypad. Product specification. December 2008 V0.a. ByVac 2006 ByVac Page 1 of 9

3.Absolute maximum ratings Item Symbol Standard Unit Power voltage VDD-VSS Input voltage VIN VSS - VDD

ET-PIC 24 WEB-V1. o Central Processing Unit (CPU) o System. o nanowatt Power Managed Modes. o Analog Features

USB232 board EB Technical datasheet

Device: DSP-7S04H. This document Version: 1. Date: 23 March Description: 2.3 4x 7 segment display module with decimals

Description: 4x 7 segment display module with decimals and colon

Lab 3 LCD Mar

melabs Serial LCD Firmware Version 1.0 2/7/07

Department of Electronics and Instrumentation Engineering Question Bank

MOPS/386A (P389) MOPS/MZ and MOPSlcdMZ (PMZ1) MOPS/520 (P489) DOT Matrix Display on PC/104 Products

Embedded Systems and Software. LCD Displays

1602 SMART LCD DISPLAY MODULE HCMODU0122

Fireloch 4 Digit 7 Segment Programmable Display Module

16COM/40SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING MSC SYSTEMS ENGINEERING AND ENGINEERING MANAGEMENT SEMESTER 2 EXAMINATION 2016/2017

melabs Serial LCD Firmware Version 1.1 3/5/07

LCD03 - I2C/Serial LCD Technical Documentation

Bolt 18F2550 System Hardware Manual

16COM/80SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD

2. (2 pts) If an external clock is used, which pin of the 8051 should it be connected to?

LCDs. Embedded Systems Interfacing. 20 September 2011

User's Manual. ACPL-796J Opto-Isolated A/D Converter Evaluation Kit. Description. Preparation

MCP2120/MCP2150 DEVELOPER S KIT USER S GUIDE

Lab 5: LCD and A/D: Digital Voltmeter

Manual of Board ET-PIC STAMP 18F8722-K22 ET-PIC STAMP 18F8722-K22

COMP2121: Microprocessors and Interfacing. I/O Devices (II)

Embedded Systems. PIC16F84A Internal Architecture. Eng. Anis Nazer First Semester

Contents. The USB Logic Tool... 2 Programming... 2 Using the USB Logic Tool... 6 USB Logic Tool Features... 7 Device Hardware...

ECE 372 Microcontroller Design

JE-AN ELECTRONICS CO.,LTD. Spec. No: WG240128A

Laboratory Exercise 7 - Extended I/O & Parallel Processing

USER'S MANUAL PICEBS2. Hes-so//Valais / ISI / sap - version 1.0 PICEBS2-1/10

LCD Module with I2C / Serial Interface and Keypad Control «LCD I2C/Serial» User s Guide. Copyright 2008 IMS

16COM / 40SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD

LCD03 - I2C/Serial LCD Technical Documentation

DOT MATRIX CHARACTER LCD MODULE USER S MANUAL

Lab Experiment 9: LCD Display

Demo 8 - Programmable Timer. Introduction:

LCD6402-DEV Development/Evaluation Board for the LCD6402B LCD6402-DEV Development/Evaluation Board for the LCD6402B

Using the HT16K33 in DVD Player Panel Applications

Graphical LCD Display Datasheet EB

Project Final Report Encrypted Chat 17 April 2011 Nayan Nandihalli

420 Series RS232 only Encoder for Keypad Applications Application / Engineering Manual

PIC KIT 2 BASIC-USERS GUIDE FEMTO ELECTRONICS

LCD Module User Manual

EasyPIC5 Development System

CPLD/FPGA Development System

SimPLC. User Manual.

Lab 8 RS232 October 22, 2015

Input/Output Devices. Lecturer: Sri Parameswaran Notes by: Annie Guo

UNIT V MICRO CONTROLLER PROGRAMMING & APPLICATIONS TWO MARKS. 3.Give any two differences between microprocessor and micro controller.

8051 Intermidiate Development Board. Product Manual. Contents. 1) Overview 2) Features 3) Using the board 4) Troubleshooting and getting help

C and Embedded Systems. So Why Learn Assembly Language? C Compilation. PICC Lite C Compiler. PICC Lite C Optimization Results (Lab #13)

Application Note. Interfacing to a Graphics LCD from PSoC. Summary This Application Note describes how to control a graphic LCD in a PSoC application.

CHAPTER 12 LCD AND KEYBOARD INTERFACING

APP-II PIC Development Kit by AWC

Parallel Display Specifications Revision 1.0

Microcontroller & Interfacing

FPGA Interfacing of HD44780 Based LCD Using Delayed Finite State Machine (FSM)

Product Information. Features. Table of Contents EA DIP162 DN3LW EA DIP162 DHNLED EA DIP162 DNLED EA DIP162J DN3LW

ﻢﯿﺣﺮﻟا ﻦﻤﺣﺮﻟا ﷲا ﻢﺴﺑ

AX-12. PIC12F675 microcontroller Activity board

EMBEDDED HARDWARE DESIGN. Tutorial Interfacing LCD with Microcontroller /I

Microprocessors & Interfacing

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

Microcontroller Based Code Locking System with Alarm

MAINTENANCE MANUAL KEYPAD/DISPLAY PANEL ASSEMBLIES 19D902913G3, G4, G10 (CONVENTIONAL) 19D902913G5, G6 (EDACS)

Serial Communications

LCM NHD-0440CI-YTBL. User s Guide. (Liquid Crystal Display Module) RoHS Compliant. For product support, contact NHD CI- Y- T- B- L-

Demo 17 - Receiving data from Host through Serial Port. Introduction:

Transcription:

LABORATORY MANUAL Interfacing LCD 16x2, Keypad 4x4 and 7Segment Display to PIC18F458 1. OBJECTIVES: 1.1 To learn how to interface LCD 16x2, Keypad 4x4 and 7Segment Display to the microcontroller. 1.2 To program LCD using the assembly language. 1.3 To program Keypad 4x4 and LCD using the assembly language. 1.4 To program Keypad 4x4 and 7 Segment Display using the assembly language. 1.5 To program Keypad 4x4 and UART using the assembly language. 1.6 To draw the circuit and running the PROTEUS simulation. 1.7 To construct the hardware. 2. COMPONENTS AND EQUIPMENTS: 2.1 Mplab IDE 2.2 Sk4B/SK4C 2.3 Proteus 7.6 software 2.4 Resistor (4.7kΩ, 33Ω,1kΩ) 2.5 Led 2.6 Push Button Switch 2.7 Breadboard 2.8 AC-to-DC Adaptor (9V Selected Point) 2.9 Pickit2 programmer UICA 2.1 Pickit2 programmer software 2.11 Serial cable/usb serial port 2.12 HyperTerminal software 2.13 Virtual serial port software 2.14 7Segment Display 2.15 LCD 16x2 2.16 Keypad 4x4 2.17 Potential Meter 5kΩ 2.18 2N394 (NPN-Transistor) 3. INTRODUCTION: 3.1 LCD 16x2 3.1.1 LCD Pin Descriptions - 1 -

Pin Symbol I/O Description 1 GND -- Ground (V) 2 VDD -- +5V power supply 3 V -- Power Supply for LCD 4 RS I RS= to select COMMAND register (send command) RS=1 to select DATA register (send data) 5 R/W I R/W= for WRITE to LCD R/W=1 for READ from LCD 6 E I/O Enable 7 DB I/O The 8-bit data bus 8 DB1 I/O The 8-bit data bus 9 DB2 I/O The 8-bit data bus 1 DB3 I/O The 8-bit data bus 11 DB4 I/O The 8-bit data bus 12 DB5 I/O The 8-bit data bus 13 DB6 I/O The 8-bit data bus 14 DB7 I/O The 8-bit data bus 15 BL1 -- Backlight Power (+5V) 16 BL2 -- Backlight Power (V) 3.1.2 LCD Pin Configurations Table1: LCD pin descriptions 1 2 3 4 5 6 7 8 9 1 11 12 13 14 15 16 VSS VCC VEE RS R/W E DB DB1 DB2 DB3 DB4 DB5 DB6 DB7 LED+ LED- Table2: LCD pin configuration 3.1.3 LCD Command Codes The 8-bit data pins D-D7 are used to send information to the LCD or read the contents of the LCD s internal registers. We send ASCII codes to display letters or numbers while making RS=1. Code (HEX) Command to LCD Instruction Register. 1 Clear display screen 2 Return home 4 Decrement cursor (shift cursor to left) 6 Increment cursor (shift cursor to right) 5 Shift display right 7 Shift display left 8 Display off, cursor off A Display off, cursor on C Display on, cursor off E Display on, cursor blinking off - 2 -

F Display off, cursor blinking on 1 Shift cursor position to left 14 Shift cursor position to right 18 Shift the entire display to the left 1C Shift the entire display to the right 8 Force cursor to beginning of 1 st line C Force cursor to beginning of 2 nd line 38 2 lines and 5x7 matrix Table3: LCD command codes 3.1.4 LCD Connection PIC 18 LCD RD D VDD V RD7 D7 GND RS R/W E RC RC1 RC2 Figure1: LCD pin connections to microcontroller 3.1.5 Sending Data and Command to LCD There are two ways to send characters (command/data) to the LCD: Use a delay before sending the next one. Use the busy flag to see if the LCD is ready for the next one. - 3 -

Using a time Delay The delay between issuing each character to the LCD is about 5-1mS (we call it simply DELAY). In programming an LCD, we also need a long delay for the power-up process, (we call it long delay LDELAY). In order to enable LCD s input, the short delay is needed to make the En signal wide enough. Using Busy Flag \ 3.2 KEYPAD 4x4 The busy flag is D7, and can be read when R/W=1 and RS=. When D7 =1 (busy flag=1), the LCD is busy taking care of internal operations and will not accept any new information. When D7=, the LCD is ready to receive new information. Usually keyboards organized in a matrix of rows and columns. The CPU accesses both rows and columns through ports. When a key pressed, a row and column make a contact; otherwise there is no connection between rows and columns. To interface keypad, we must have two processes a) key press detection, and b) key identification. There are two ways, to perform key press detection: The interrupt method (PortB-Change interrupt can be used) Scanning method 3.2.1 Interrupt Method using PORTB Change Interrupt By using 4x4 matrix keypad connected to PORTB. The rows are connected to PORTB-Low (RB-RB3) and the columns are connected to PORTB-High (RB4-RB7), which is the PORTB-Change interrupt. Note: Refer your reference book at pages 449-452 for details information using PORTB change interrupt. 1 2 3 A 4 5 6 B 7 8 9 C * # D

Figure 2: Matrix Keypad Connections to Ports Figure3: Keypad 4x4 KEYPAD 4x4 RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB C1 C2 C3 C4 R4 R3 R2 R1 1 2 3 A 4 5 6 B 7 8 9 C * # D PIC18F458 C1 C2 C3 C4 R1 R2 R3 R4 Figure 4: Keypad pin connections to microcontroller - 5 -

Figure 5: Key Press Detection Flowchart. - 6 -

3.2.2 Scanning Method Figure 6: Flowchart of Scanning Method for Key Press Detection - 7 -

3.3 7SEGMENT DISPLAY A seven-segment display (SSD), or seven-segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot-matrix displays. Seven-segment displays are widely used in digital clocks, electronic meters, and other electronic devices for displaying numerical information. The SSD consists of 7 LED s described from figure 6 below. Usually SSD was made in two types which are common cathode and common anode but here we are focus in common anode only. 3.3.1 7Segment Display Pin Connections +5V MSB G 1 PORTD7 ANODE F 2 PORTD6 E D DP C B 4 PORTD5 5 PORTD4 6 PORTD3 7 PORTD2 9 PORTD1 A 3,8 1 PORTD 7-SEGMENT LSB PIC18F458 Figure7: common anode 7segment display pin connections to microcontroller. - 8 -

3.3.2 7Segment Display Label Figure8: 7Segment Visual Structure 3.3.3 7Segment Truth Table Common Anode MICRONTROLLER PORTD DATA POTRD7 POTRD6 POTRD5 POTRD4 POTRD3 POTRD2 POTRD1 POTRD DIPLAY G F E D DP C B A 1 1 1 1 1 1 1 2 1 1 3 1 1 4 1 1 1 5 1 1 6 1 7 1 1 1 1 8 9 1 1 A 1 B 1 1 C 1 1 1 D 1 1 E F 1 1 1 1 1 Table 4: 7segment display truth table common anode - 9 -

4. PROCEDURES. a. Copy the source code from the source code file and design the circuit by using the PROTEUS has shown in Figure 9 and Table 5 at appendices. Load the program onto the simulation and running the simulation for LCD source code. b. Construct the hardware and prove the results by compare with simulation. c. Copy the source code from the source code file and design the circuit by using the PROTEUS has shown in Figure 1 and Table 6 at appendices. Load the program onto the simulation and running the simulation for Keypad and LCD source code. d. Construct the hardware and prove the results by compare with simulation. e. Copy the source code from the source code file and design the circuit by using the PROTEUS has shown in Figure 11 and Table 7 at appendices. Load the program onto the simulation and running the simulation for Keypad and 7Segment Display source code. f. Construct the hardware and prove the results by compare with simulation. g. Copy the source code from the source code file and design the circuit by using the PROTEUS has shown in Figure 12 and Table 8 at appendices. Load the program onto the simulation and running the simulation for Keypad and HyperTerminal source code. h. Construct the hardware and prove the results by compare with simulation. 5. APPENDICES. - 1 -

Components CAP CYSTAL Figure 9: Interfacing with LCD connection Values/Configurations 22pF X1 (2Mhz) PIC18f458(U1) FREQ = 2MHZ RES SWITCH LCD POT R1=4.7k SW RESET LM16L RV1=5k Table 5: Components Figure 1: Interfacing with Keypad 4x4 and LCD connection Components CAP Values/Configurations 22pF - 11 -

CYSTAL X1 (2Mhz) PIC18f458(U1) FREQ = 2MHZ RES SWITCH LCD POT KEYPAD R1=4.7k SW RESET LM16L RV1=5k KEYPAD-SMALLCALC Table 6: Components Figure 11: Interfacing with Keypad 4x4 and 7segment display connection Components CAP Values/Configurations 22pF - 12 -

CYSTAL X1 (2Mhz) PIC18f458(U1) FREQ = 2MHZ RES SWITCH Q1 POT R1=4.7k, R2-R9=33, R1=1k SW RESET 2N394 (NPN) RV1=5k 7 Segment 7SEGMENT-COM-AN-GREEN Table 7: Components Figure 12: Interfacing with Keypad 4x4 and HyperTerminal connection Components CAP CYSTAL Values/Configurations 22pF X1 (2Mhz) - 13 -

PIC18f458(U1) FREQ = 2MHZ RES SWITCH COMPIM(P1) R1=4.7k SW RESET Port = com1, baud rate = 96, Data bits = 8, Parity = NONE. Table 8: Components Figure 13: Schematic and Pin Connection 2N394-14 -