Interfacing LCD display controller.


Project Name: Interfacing LCD display controller.

Objective of Project:
Programming the AT89C2051 microcontroller to show the sentence “I LOVE YOU” on 16x2 line LCD display.

Circuit Diagram:





List of components:


SL
Name and Description
Quantity
1
MCU 89C2051
1
2
LED
2
3
Resistance 1K Ohm
4
4
Capacitors 30pf
(10 uf 50Volt(1),100uf 50Volt(1))
2
5
Crystal Q11.059A1
1
6
Voltage regulator 7805
1
7
Bread board
2
8
Connecting wires

9
Battery 9 Volt
1
10
16*2 LCD display
1

Printout of Program:

; P1.0-P1.7=D0-D7, P3.0=RS, P3.1=R/W, P3.2=E
ORG 0
MOV DPTR,#MYCOM
C1:
CLR A
MOVC A,@A+DPTR
ACALL COMNWRT           ;call command subroutine
ACALL DELAY      ;give LCD some time
INC DPTR
JZ SEND_DAT
SJMP C1

SEND_DAT:
MOV DPTR,#MYDATA
D1: CLR A
MOVC A,@A+DPTR
ACALL DATAWRT              ;call command subroutine
ACALL DELAY      ;give LCD some time
INC DPTR
JZ AGAIN
SJMP D1

AGAIN: SJMP AGAIN      ;stay here

COMNWRT:                        ;send command to LCD
MOV P1,A                           ;copy reg A to P1
CLR P3.0                               ;RS=0 for command
CLR P3.1                               ;R/W=0 for write
SETB P3.2                             ;E=1 for high pulse
ACALL DELAY      ;give LCD some time
CLR P3.2                               ;E=0 for H-to-L pulse
RET

DATAWRT:                          ;write data to LCD
MOV P1,A                           ;copy reg A to port 1
SETB P3.0                             ;RS=1 for data
CLR P3.1                               ;R/W=0 for write
SETB P3.2                             ;E=1 for high pulse
ACALL DELAY      ;give LCD some time
CLR P3.2                               ;E=0 for H-to-L pulse
RET

DELAY: MOV R3,#250     ;50 or higher
HERE2: MOV R4,#255     ;R4 = 255
HERE: DJNZ R4,HERE       ;stay until R4 becomes 0
DJNZ R3,HERE2
RET

ORG 300H
MYCOM: DB 38H,0EH,01,06,84H,0
; commands and null
MYDATA: DB "I LOVE YOU",0
END 

Brief Description of Program:

Here,
In program P1.0-P1.7=D0-D7, P3.0=RS, P3.1=R/W, P3.2=E. We defined the COMNWRT subroutine to send command to the LCD. And we defined the DATAWRT subroutine to write data to the LCD. We defined our command codes in the memory location 300h. And then our display codes.

Achievements (Result):
By this project we can learn about how to program microprocessor and get the output on 16*2 LCD display. Here we use AT89C2051 microcontroller. We program it for showing “I LOVE YOU”. We program this reason and they are working as we program.


See the project: https://youtu.be/YmSKIYwQ2x0

Comments