Home Automation, Networking, and Entertainment LabDept. of Computer Science and Information Engineering
National Cheng Kung UniversityChung-Ping Young
REAL-WORLD INTERFACING I LCD, ADC, AND SENSORSDepartment of Computer Science and Information EngineeringNational Cheng Kung University2INTERFACING LCD TO 8051 HANEL
LCD OperationLCD 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 University3INTERFACING LCD TO 8051LCD Pin Descriptions HANELPin Descriptions for LCDDescriptionsGround+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 DB7used 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 University4INTERFACING LCD TO 8051 HANEL
LCD Command CodesForce cursor to beginning to 1st line
80Force cursor to beginning to 2nd line
C02 lines and 5x7 matrix
38Shift the entire display to the right
1CShift the entire display to the left
18Shift cursor position to right
14Shift cursor position to left
10Display on, cursor blinking
FDisplay on, cursor blinking
EDisplay on, cursor off
CDisplay off, cursor on
ADisplay off, cursor off
8Shift display left
7Shift display right
5Increment cursor (shift cursor to right)
6Decrement cursor (shift cursor to left)
4Return home
2Clear display screen
1Command to LCD Instruction Register
LCD Command Codes Code (Hex)