BME DEPARTMENT
MGMCET
BME DEPARTMENT
ACKNOLEGEMENT
MGMCET
BME DEPARTMENT
Symbol
VSS
VDD(VCC)
VEE
RS
R/W
E
DB0
DB1
DB2
DB3
DB4
DB5
DB6
DB7
I/O
I
I
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
Description
Ground
+5V power supply
Contrast control
command/data register selection
write/read selection
Enable
The 8-bit data bus
The 8-bit data bus
The 8-bit data bus
The 8-bit data bus
The 8-bit data bus
The 8-bit data bus
The 8-bit data bus
The 8-bit data bus
MGMCET
BME DEPARTMENT
R/W - read/write:
R/W input allows the user to write information to the LCD or read information from
it. R/W = 1 when reading; R/W =0 when writing.
E - enable:
The enable pin is used by the LCD to latch information presented to its data pins. When
data is supplied to data pins, a high to low pulse must be applied to this pin in order for the LCD
to latch in the data present at the data pins. This pulse must be a minimum of 450 ns wide.
D0 D7:
The 8 bit data pins, D0 D7, are used to send information to the LCD or read the
contents of the LCDs internal registers.
To display letters and numbers, we send ASCII codes for the letters A Z, a z, and
numbers 0 9 to these pins while making RS = 1.
MGMCET
BME DEPARTMENT
There are also instructions command codes that can be sent to the LCD to clear
the display or force the cursor to the particular position
Code (hex)
1
2
4
5
6
7
8
A
C
E
F
10
14
18
1C
80
C0
38
MGMCET
BME DEPARTMENT
MGMCET
BME DEPARTMENT
ACALL COMNWRT
ACALL DELAY
MOV A,#0EH
ACALL COMNWRT
ACALL DELAY
MOV A,#01
;
;
ACALL COMNWRT
ACALL DELAY
MOV A,#06H
ACALL COMNWRT
ACALL DELAY
MOV A,#84H
ACALL COMNWRT
ACALL DELAY
MOV A,#'H'
;
;
ACALL DATAWRT
ACALL DELAY
MOV A,#'E'
;
;
ACALL DATAWRT
ACALL DELAY
MOV A,#'L'
;
;
ACALL DATAWRT
ACALL DELAY
;
;
MGMCET
BME DEPARTMENT
MOV A,#'L'
ACALL DATAWRT
ACALL DELAY
;
;
MOV A,#'O'
ACALL DATAWRT
MOV P1,A
CLR P2.0
CLR P2.1
SETB P2.2
ACALL DELAY
CLR P2.2
RET
DATAWRT:
MOV P1,A
SETB P2.0
CLR P2.1
SETB P2.2
ACALL DELAY
CLR P2.2
RET
DELAY: MOV R3,#50 ;
HERE2: MOV R4,#255 ;
HERE: DJNZ R4,HERE ;
DJNZ R3,HERE2
RET
END
MGMCET
BME DEPARTMENT
Program in Keil:1)
MGMCET
BME DEPARTMENT
2)
MGMCET
BME DEPARTMENT
Connection in Proteus:-