📄 1602.asm
字号:
RS EQU P2.7
RW EQU P2.6
E EQU P2.5
ORG 0000H
AJMP START
ORG 0033H
START: MOV SP,#60H
MAIN: LCALL DELAY
MOV P0,#01H
LCALL ENABLE
MOV P0,#38H
LCALL ENABLE
MOV P0,#0FH
LCALL ENABLE
MOV P0,#06H
LCALL ENABLE
MOV DPTR,#TABLE1;表格首址送数据指针
mov r3,#33 ;文字屏数
list: mov p0,#01h ;清屏
lcall enable
MOV P0,#80H ;第一行起始字符地址
LCALL ENABLE
LCALL DISP ;显示子程序
MOV P0,#0C0H ;第二行起始字符地址
LCALL ENABLE
LCALL DISP ;显示子程序
djnz r3,list ;所有屏数是否显示完成
AJMP MAIN
ENABLE: CLR RS
CLR RW
CLR E
LCALL DELAY
SETB E
RET
DISP: MOV R1,#16 ;每行16个字符
LOOP: MOV A,#00H
MOVC A,@A+DPTR
LCALL DISP1
INC DPTR ;数据指针加一
DJNZ R1,LOOP ;16个字符显示是否完成
RET
DISP1: MOV P0,A
SETB RS
CLR RW
CLR E
LCALL DELAY
SETB E
RET
DELAY: MOV R7,#255
D1: MOV R6,#255
DJNZ R6,$
DJNZ R7,D1
RET
TABLE1: DB "1) I love you not because "
db "of who you are, but because "
db "of who I am when I am with "
db "you. "
db "2) No man or woman is worth "
db "your tears, and the one who "
db "is, won't make you cry. "
db "3) The worst way to miss "
db "someone is to be sitting "
db "right beside them knowing "
db "you can't have them."
db "4) Never frown, even when "
db "you are sad, because you "
db "never know who is falling "
db "in love with your smile. "
db " "
db "5) To the world you may "
db "be one person, but to one "
db "person you may be the "
db "world. "
db "6) Don't waste your time "
db "on a man/woman, who isn't "
db "willing to waste their "
db "time on you. "
db "7) Just because someone "
db "doesn't love you the way "
db "you want them to, doesn't "
db "mean they don't love you "
db "with all they have. "
db "8) Don't try so hard, the "
db "best things come when you "
db "least expect them to."
db " "
db "9) Maybe God wants us to "
db "meet a few wrong people "
db "before meeting the right "
db "one, so that when we "
db "finally meet the person, "
db "we will know how to be "
db "grateful. "
db "10) Don't cry because "
db "it is over, smile because"
db " it happened. "
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -