Program:
EN equ P2.0
RS equ P2.1
RW equ P2.2
mov A,#38H ; Setting Up the LCD
lcall command
mov A,#0EH ; Display On
lcall command
mov A,#06H ; Entry Mode
lcall command
mov a,#82H
lcall command
lcall disp ; Function Disp Called
mov a,#02H ; Setting DDRAM Address to Home position
lcall command
lcall delay1
Displays fantasy ON FIRST LINE OF LCD
mov a,#'F'
lcall datw
NOP
mov a,#'A'
lcall datw
NOP
mov a,#'N'
lcall datw
mov a,#'T'
lcall datw
NOP
mov a,#'A'
lcall datw
NOP
mov a,#'S'
lcall datw
NOP
mov a,#'Y'
lcall datw
NOP
MOV A,#255 ; Moving Value 255 to PORT 3
MOV P3,A
; Keypad Scan Begins
sd:
lcall delay1
lcall key1
lcall delay
lcall key2
lcall delay
lcall key3
lcall delay
lcall key4
lcall delay
lcall sd
Function to Send Commands to LCD
command:
clr RW
clr RS
setB EN
MOV P1,A
lcall delay
clr EN
RET
Function to Clear the DDRAM Content
clear:
mov A,#01H
lcall command
lcall delay
mov A,#02H ; Set The DDRAM Address to Home Position
lcall command
lcall delay
RET
Function to Display Data on LCD Screen
datw:
SETB RS
clr RW
SETB EN
MOV P1,A
lcall delay
clr EN
RET
EN equ P2.0
RS equ P2.1
RW equ P2.2
mov A,#38H ; Setting Up the LCD
lcall command
mov A,#0EH ; Display On
lcall command
mov A,#06H ; Entry Mode
lcall command
mov a,#82H
lcall command
lcall disp ; Function Disp Called
mov a,#02H ; Setting DDRAM Address to Home position
lcall command
lcall delay1
Displays fantasy ON FIRST LINE OF LCD
mov a,#'F'
lcall datw
NOP
mov a,#'A'
lcall datw
NOP
mov a,#'N'
lcall datw
mov a,#'T'
lcall datw
NOP
mov a,#'A'
lcall datw
NOP
mov a,#'S'
lcall datw
NOP
mov a,#'Y'
lcall datw
NOP
MOV A,#255 ; Moving Value 255 to PORT 3
MOV P3,A
; Keypad Scan Begins
sd:
lcall delay1
lcall key1
lcall delay
lcall key2
lcall delay
lcall key3
lcall delay
lcall key4
lcall delay
lcall sd
Function to Send Commands to LCD
command:
clr RW
clr RS
setB EN
MOV P1,A
lcall delay
clr EN
RET
Function to Clear the DDRAM Content
clear:
mov A,#01H
lcall command
lcall delay
mov A,#02H ; Set The DDRAM Address to Home Position
lcall command
lcall delay
RET
Function to Display Data on LCD Screen
datw:
SETB RS
clr RW
SETB EN
MOV P1,A
lcall delay
clr EN
RET
No comments:
Post a Comment