Thursday, 18 April 2013

Interfacing of LCD with 8051 Microcontroller

PROGRAM CODE:
ORG 0000H
MOV A,#38H
ACALL COM
MOV A,#0EH
ACALL COM
MOV A,#01H
ACALL COM
MOV A,#10H
ACALL COM
MOV A,#80H
ACALL COM
AGAIN: ACALL DISPLAY
MOV A,#01H
ACALL COM
SJMP AGAIN
COM: ACALL DELAY
CLR P2.0
CLR P2.1
SETB P2.2
MOV P1,A
ACALL DELAY
CLR P2.2
ACALL DELAY
RET
DATA1: ACALL DELAY
SETB P2.0
CLR P2.1
SETB P2.2
MOV P1,A
ACALL DELAY
CLR P2.2
ACALL DELAY
RET
DELAY: MOV R0,#15H
GO: MOV TMOD,#01H
MOV TL0,#0FFH
MOV TH0,#0DBH
SETB TR0
BACK: JNB TF0,BACK
CLR TR0
CLR TF0
DJNZ R0,GO
RET
DISPLAY: MOV R1,#14D
MOV A,#00H
MOV DPTR,#MYDATA
NEXT: CLR A
MOVC A,@A+DPTR
JZ OUT
ACALL DATA1
INC DPTR
CLR A
DJNZ R1,NEXT
OUT: RET
MYDATA:DB "Amit Kr Bharti"
END


No comments:

Post a Comment