Lcd interfaing using 8051 and assambly language programming
3,178 views
18 slides
Oct 17, 2020
Slide 1 of 18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
About This Presentation
Lcd interfacing using 8051 and assembly language programming
Size: 741.89 KB
Language: en
Added: Oct 17, 2020
Slides: 18 pages
Slide Content
Interfacing LCD to microcontroller 8051 Dr. Vikas Dongre HOD Electronics Government Polytechnic Washim Maharashtra, India [email protected] With KEIL program and Proteus Simulation
LCD is finding widespread use replacing LEDs The declining prices of LCD, descent looking, less power consumption 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 Seven Segment Display Liquid Crystal Display (LCD) Liquid Crystal Display
Pin Symbol I/O Description 1 Vss - Ground 2 Vdd - +5V Power Supply 3 Vee - Contrast control power supply 4 RS Register select RS=0 Command register RS=1 Data register 5 R/W I R- Write/ W-Read 6 E I Enable 7-14 DB0-DB7 I/O Data Bus 16x2 LCD Display
Working of LCD Display controller Command Register : Controls the working of LCD Controller Data Register : Used to store the data to be displayed on LCD Alphanumeric and graphic Character set memory for various languages
Code Command to LCD Instruction Register 01 Clear display screen 02 Return home 04 Decrement cursor (shift cursor to left) 06 Increment cursor (shift cursor to right) 05 Shift display right 07 Shift display left 08 Display off, cursor off 0A Display off, cursor on 0C Display on, cursor off Co de Command to LCD Instruction Register 0E Display on, cursor blinking 10 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 80 Force cursor to beginning to 1st line C0 Force cursor to beginning to 2nd line 38 2 lines and 5x7 matrix
Algorithm Start Initialize LCD by providing various commands to Control register Send data to be displayed on Data register byte by byte Stop
COMNWRT: ;send command to LCD MOV P0, A ;copy reg A to port 0 CLR RS ;RS=0 for command Register CLR RW ;R/W=0 for write SETB E ;E=1 for high pulse CLR E ;E=0 for H-to-L pulse ACALL DELAY ;give LCD some time RET Subroutine for Writing in Command Register DATAWRT: ;send command to LCD MOV P0,A ;copy reg A to port 1 SETB RS ;RS=1 for Data Register CLR RW ;R/W=0 for write SETB E ;E=1 for high pulse CLR E ;E=0 for H-to-L pulse ACALL DELAY ;give LCD some time RET Subroutine for Writing in Data Register
ORG 0000 MOV A,#38H ;INIT. LCD 2 LINES, 5X7 MATRIX ACALL COMNWRT ;call command subroutine MOV A,#0EH ;display on, cursor on ACALL COMNWRT ;call command subroutine MOV A,#01 ;clear LCD ACALL COMNWRT ;call command subroutine MOV A,#06H ;shift cursor right ACALL COMNWRT ;call command subroutine MOV A,#86H ;cursor at line 1, pos. 6 ACALL COMNWRT ;call command subroutine Program to display the word “WORLD” on 16x2 LCD Display Initialize Control register
MOV A ,#“ W " ;display letter W ACALL DATAWRT ; call display subroutine MOV A ,#“ O " ;display letter O ACALL DATAWRT ;call display subroutine MOV A ,#“ R " ;display letter R ACALL DATAWRT ; call display subroutine MOV A ,#“ L " ;display L ACALL DATAWRT ; call display subroutine MOV A,#“ D " ;display D ACALL DATAWRT ;call display subroutine Send data to be displayed on Data register
COMNWRT: ;send command to LCD MOV P0,A ;copy reg A to port 1 CLR P1.0 ;RS=0 for command CLR P1.1 ;R/W=0 for write SETB P1.2 ;E=1 for high pulse CLR P1.2 ;E=0 for H-to-L pulse ACALL DELAY ;give LCD some time RET COMMAND WORD SUBROUTINE
DATAWRT: ;write data to LCD MOV P0,A ;copy reg A to port 1 SETB P1.0 ;RS=1 for DATA CLR P1.1 ;R/W=0 for write SETB P1.2 ;E=1 for high pulse CLR P1.2 ; E=0 for H-to-L pulse ACALL DELAY ;give LCD some time RET DATA WORD SUBROUTINE
DELAY : MOV R3,#255 ;OUTER COUNT HERE2: MOV R4,#255 ;INNER COUNT HERE: DJNZ R4,HERE ;stay until R4 becomes 0 DJNZ R3,HERE2 RET END DELAY SUBROUTINE
Output with KEIL program and Proteus Simulation
Thank you !!! Dr. Vikas Dongre HOD Electronics Government Polytechnic Washim [email protected]