The 8051 Microcontroller and Embedded

(lily) #1
Home Automation, Networking, and Entertainment LabDept. of Computer Scienc

e and Information Engineering
National Cheng Kung University

Chung-Ping Young
REAL-WORLD INTERFACING I LCD, ADC, AND SENSORS

Department of Computer Science and Information EngineeringNational Cheng Kung University

2

INTERFACING LCD TO 8051 HANEL
LCD Operation

‰LCD is finding widespread use replacing LEDs¾The declining prices of LCD¾The ability to display numbers, characters, and graphics¾Incorporation of a refreshing controller into the LCD, thereby relieving the CPU of the task of refreshing the LCD¾Ease of programming for characters and graphics


Department of Computer Science and Information EngineeringNational Cheng Kung University

3

INTERFACING LCD TO 8051LCD Pin Descriptions HANEL

Pin Descriptions for LCD

DescriptionsGround+5V power supplyPower supply to control contrastRS=0 to select command register, RS=1 to select data registerR/W=0 for write, R/W=1 for readEnableThe 8-bit data busThe 8-bit data busThe 8-bit data busThe 8-bit data busThe 8-bit data busThe 8-bit data busThe 8-bit data busThe 8-bit data busI/O
PinI/OSymbolVSS 1 -- 2 VCC-- VEE-- 3 4 IRS 5 R/WI 6 EI/ODB0 7 I/O 8 DB1I/O 9 DB2I/O 10 DB3I/O 11 DB4I/O 12 DB5I/O 13 DB6I/O 14 DB7

used by the LCD to latch information presented to its data bus


  • Send displayed information or instruction command codes to the LCD - Read the contents of the LCD’s internal registers


Department of Computer Science and Information EngineeringNational Cheng Kung University

4

INTERFACING LCD TO 8051 HANEL
LCD Command Codes

Force cursor to beginning to 1st line
80

Force cursor to beginning to 2nd line
C0

2 lines and 5x7 matrix
38

Shift the entire display to the right
1C

Shift the entire display to the left
18

Shift cursor position to right
14

Shift cursor position to left
10

Display on, cursor blinking
F

Display on, cursor blinking
E

Display on, cursor off
C

Display off, cursor on
A

Display off, cursor off
8

Shift display left
7

Shift display right
5

Increment cursor (shift cursor to right)
6

Decrement cursor (shift cursor to left)
4

Return home
2

Clear display screen
1

Command to LCD Instruction Register
LCD Command Codes Code (Hex)
Free download pdf