Skip to content

Commit 86ef7d4

Browse files
authored
Add files via upload
1 parent 9c17a89 commit 86ef7d4

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

LCD_Interface/LCD.asm

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
; Displaying character on LCD using Assembly Language
2+
3+
ORG 00H
4+
5+
; RS = P2.0 , RW = P2.1, E=P2.2, D0 -D7 = P1.0 - P1.7
6+
7+
RS EQU P2.0 ; EQU means equating (i.e RS = P2.0)
8+
RW EQU P2.1
9+
E EQU P2.2
10+
11+
;LCD INITIALIZATION
12+
13+
MOV P1,#38H ;2 lines and 5x7 matrix
14+
; load 38H data is loaded to port P1
15+
ACALL send_command
16+
17+
MOV P1, #0EH ; display on cursor blink
18+
ACALL send_command
19+
20+
MOV P1 ,#01H ;clear display screen
21+
ACALL send_command
22+
23+
here: MOV P1,#80H ; Force cursor to 1st line
24+
ACALL send_command
25+
26+
; Printing a command
27+
28+
MOV P1,#'H' ;#'E' means we want to transmit ASCII value of E
29+
ACALL send_data
30+
MOV P1,#'E'
31+
ACALL send_data
32+
MOV P1,#'L'
33+
ACALL send_data
34+
MOV P1,#'L'
35+
ACALL send_data
36+
MOV P1,#'O'
37+
ACALL send_data
38+
39+
MOV P1,#0C0H ; Force cursor to 2nd line
40+
ACALL send_command
41+
42+
MOV P1,#'W'
43+
ACALL send_data
44+
MOV P1,#'O'
45+
ACALL send_data
46+
MOV P1,#'R'
47+
ACALL send_data
48+
MOV P1,#'L'
49+
ACALL send_data
50+
MOV P1,#'D'
51+
ACALL send_data
52+
53+
JMP here
54+
55+
send_command: CLR RW
56+
CLR RS
57+
SETB E
58+
ACALL DELAY
59+
CLR E
60+
RET
61+
62+
send_data: CLR RW
63+
SETB RS
64+
SETB E
65+
ACALL DELAY
66+
CLR E
67+
RET
68+
69+
DELAY : MOV R0, #10
70+
Here2 : MOV R1, #255
71+
Here1 : DJNZ r1, here1
72+
DJNZ R0, here2
73+
74+
RET
75+
76+
END

0 commit comments

Comments
 (0)