pic18 LCD interfacing

13
4 MICROCONTROLLER BOARD { Alphanumeric LCD and Keypad} Mohamad Fauzi Zakaria http://fkee.uthm.edu.my/mfauzi Contents Contents 2 Hardware Setup for Hitachi HD44780 LCD controller. Ti i Di Timing Diagram Command Set DDRAM Address h Character Pattern LCD Programming Function Library for XLCD

description

ec501,pic18

Transcript of pic18 LCD interfacing

Page 1: pic18 LCD interfacing

44

MICROCONTROLLER BOARD{ Alphanumeric LCD and Keypad}Mohamad Fauzi Zakaria

http://fkee.uthm.edu.my/mfauzi

ContentsContents2

Hardware Setup for Hitachi HD44780 LCD controller.

Ti i DiTiming Diagram

Command Set

DDRAM Address

hCharacter Pattern

LCD Programmingg g

Function Library for XLCD

Page 2: pic18 LCD interfacing

SchematicSchematic3

3 January, 2011mfauzi

Timing Diagram4

Timing Diagram

Page 3: pic18 LCD interfacing

Command Set {1}Command Set {1}5

Command Set {2}Command Set {2}6

Page 4: pic18 LCD interfacing

Command Set {3}Command Set {3}7

DDRAM ADDRESSDDRAM ADDRESS8

Page 5: pic18 LCD interfacing

Character Pattern {1}Character Pattern {1}9

Character Pattern {2}Character Pattern {2}10

Page 6: pic18 LCD interfacing

Character Pattern {3}Character Pattern {3}11

LCD ‐ ProgrammingLCD ‐ Programming12

Page 7: pic18 LCD interfacing

LCD Subroutine ‐ DriverLCD Subroutine ‐ Driver13

LCD Subroutine ‐ SetupLCD Subroutine ‐ Setup14

Page 8: pic18 LCD interfacing

Application – Main FunctionApplication – Main Function15

Function Library for XLCDFunction Library for XLCD16

Page 9: pic18 LCD interfacing

Macros for Selecting LCD Pin Assignments

17

Macros for Selecting Selecting 4 or 8 bit Mode

18

Page 10: pic18 LCD interfacing

XLCD Delay FunctionsXLCD Delay Functions19

The XLCD libraries also require that the following functions be defined by the user to provide the appropriate delays:defined by the user to provide the appropriate delays:

Example of Use “xlcd h” {1}Example of Use  xlcd.h  {1}20

Page 11: pic18 LCD interfacing

Example of Use “xlcd h” {2}Example of Use  xlcd.h  {2}21

Example of Use “xlcd h” {3}Example of Use  xlcd.h  {3}22

Page 12: pic18 LCD interfacing

Keypad23

Keypad

A keypad is simply an array of push buttons connected in rows and columnsin rows and columns.

Two processes of keypad programming: k d t ti1. key press detection

1. Interrupt method2. Scanning method

2. key identification. y

3 January, 2011mfauzi

Interrupt Method Key Press Detection24

Interrupt Method Key Press Detection

If RB3 – RB0 = 1110 for the d RB7 RB4 1011

0

row and RB7 - RB4 = 1011 for the column.

1

1

Then, the key number 2 was 1 0 1 11

Then, the key number 2 was pressed.

1 0 1 1

3 January, 2011mfauzi

Page 13: pic18 LCD interfacing

25

Scanning Method for Key Press Detection

Flow Chart for Program 12 – 4

3 January, 2011mfauzi

Program 12 4