;12864液晶显示源程序全部程序如下:
;============================
COM EQU 20H
LINE EQU 31H
DAT EQU 21H
COLUMN EQU 30H
PAGE0 EQU 31H
CODE0 EQU 32H
COUNT EQU 33H
CSA EQU P3.2 ;15
CSB EQU P3.4 ;16
D_I EQU P3.7 ;4
R_W EQU P3.6 ;5
E EQU P3.5 ;6
;=================================================
;中文演示程序段
ORG 0000H
AJMP MAIN
ORG 20H
MAIN: MOV SP,#60H
ACALL INT ;初始化子程序
ACALL DELAY ;延时子程序
ACALL CLEAR ;清屏子程序
;==============================================
;第一页第一行第1~2汉字显示
;==================
MOV R1,#50H ;x坐标
MOV R2,#0 ;计数器初始化(汉字数)
YS_1: MOV PAGE0,#02H ;y坐标
MOV COLUMN,R1
MOV CODE0,R2
ACALL CCW_PR ;中文字符写入子程序
ACALL DELAY ;延时程序
ACALL DELAY ;延时程序
MOV A,R1
ADD A,#10H ;两汉字间间隔距离(16象素点)
MOV R1,A
INC R2
CJNE R2,#3,YS_1 ;屏蔽后将让第2字不显示
CALL DELAY ;延时程序
CALL DELAY ;延时程序
;=========================================
;第一页第一行第3~5汉字显示
;=============
MOV R1,#80H
MOV R2,#3
YS_2: MOV PAGE0,#02H
MOV COLUMN,R1
MOV CODE0,R2
ACALL CCW_PR
ACALL DELAY
ACALL DELAY
MOV A,R1
ADD A,#10H
MOV R1,A
INC R2
CJNE R2,#05,YS_2 ;屏蔽后让4~5字不显示
;=========================================
;第一页第二行汉字显示
;===============
MOV R1,#50H
MOV R2,#5
YS_3: MOV PAGE0,#04H
MOV COLUMN,R1
MOV CODE0,R2
ACALL CCW_PR
ACALL DELAY
ACALL DELAY
MOV A,R1
ADD A,#10H
MOV R1,A
INC R2
CJNE R2,#11,YS_3
; ACALL DELAY10
;============================================
;第一页第三行显示
;====================
MOV R1,#50H
MOV R2,#11
YS_4: MOV PAGE0,#06H
MOV COLUMN,R1
MOV CODE0,R2
ACALL CCW_PR
ACALL DELAY
ACALL DELAY
MOV A,R1
ADD A,#10H
MOV R1,A
INC R2
CJNE R2,#15,YS_4
ACALL DELAY10
ACALL DELAY10
ACALL DELAY10
ACALL DELAY10
ACALL CLEAR
;==============================================
;第二页第一行显示
;==================
MOV R1,#60H
MOV R2,#15
YS_5: MOV PAGE0,#02H
MOV COLUMN,R1
MOV CODE0,R2
ACALL CCW_PR
ACALL DELAY
ACALL DELAY
MOV A,R1
ADD A,#10H
MOV R1,A
INC R2
CJNE R2,#19,YS_5
;=============================================
;第二页第二行显示
;=====================
MOV R1,#50H
MOV R2,#19
YS_6: MOV PAGE0,#04H
MOV COLUMN,R1
MOV CODE0,R2
ACALL CCW_PR
ACALL DELAY
ACALL DELAY
MOV A,R1
ADD A,#10H
MOV R1,A
INC R2
CJNE R2,#25,YS_6
;==============================================
ACALL DELAY10
ACALL DELAY10
ACALL DELAY10
ACALL DELAY10
ACALL CLEAR
ACALL DELAY10
;=============================================
;第三页显示
;====================
MOV R1,#50H
MOV R2,#25
YS_7: MOV PAGE0,#02H
MOV COLUMN,R1
MOV CODE0,R2
ACALL CCW_PR
ACALL DELAY
ACALL DELAY
MOV A,R1
ADD A,#10H
MOV R1,A
INC R2
CJNE R2,#31,YS_7
;==============================================
ACALL DELAY10
ACALL DELAY10
ACALL DELAY10
ACALL DELAY10
ACALL CLEAR
ACALL DELAY10
AJMP MAIN
;===============================================
;延时子程序
DELAY:PUSH 00
PUSH 01
MOV R0,#0FFH
DELAY1:
MOV R1,#0FFH
DELAY2:
DJNZ R1,DELAY2
DJNZ R0,DELAY1
POP 01
POP 00
RET
DELAY10:
MOV R4,#06H
DELAY11:
ACALL DELAY
DJNZ R4,DELAY11
RET
;==============================================
;中文字符写入子程序
CCW_PR:
NOP
MOV DPTR,#CCTAB ;表地址写入
MOV A,CODE0 ;计数器初始化(汉字数)
MOV B,#20H ;32
MUL AB
ADD A,DPL
MOV DPL,A
MOV A,B
ADDC A,DPH
MOV DPH,A
PUSH COLUMN
PUSH COLUMN
MOV CODE0,#00H
CCW_1: MOV COUNT,#10H ;16
MOV A,PAGE0
ANL A,#07H
ORL A,#0B8H
MOV COM,A
ACALL PRM0 ;写指令代码子程序(左)
ACALL PRR0 ;写指令代码子程序(右)
POP COLUMN
MOV A,COLUMN
CLR C
SUBB A,#40H
JC CCW_2
MOV COLUMN,A
SUBB A,#40H
JC CCW_11
MOV COLUMN,A
MOV A,PAGE0
SETB ACC.5
MOV PAGE0,A
LJMP CCW_2
CCW_11:
MOV A,PAGE0
SETB ACC.4
MOV PAGE0,A
CCW_2:
MOV COM,COLUMN
ORL COM,#40H
MOV A,PAGE0
ANL A,#30H
CJNE A,#10H,CCW_31
ACALL PRM0 ;写指令代码子程序(左)
LJMP CCW_4
CCW_31:
CJNE A,#20H,CCW_32
ACALL PRR0 ;写指令代码子程序(右)
LJMP CCW_4
CCW_32:
NOP
CCW_4:
MOV A,CODE0
MOV C A,@A+DPTR
MOV DAT,A
MOV A,PAGE0
ANL A,#30H
CJNE A,#10H,CCW_41
ACALL PRM1
LJMP CCW_5
CCW_41:
CJNE A,#20H,CCW_42
ACALL PRR1
LJMP CCW_5
CCW_42:
NOP
CCW_5:INC CODE0
INC COLUMN
MOV A,COLUMN
CJNE A,#40H,CCW_6
CCW_6:JC CCW_7
MOV COLUMN,#00H
MOV A,PAGE0
JB ACC.5,CCW_09
JB ACC.4,CCW_61
SETB ACC.4
MOV PAGE0,A
MOV COM,#40H
ACALL PRM0 ;写指令代码子程序(左)
LJMP CCW_7
CCW_61:
SETB ACC.5
CLR ACC.4
MOV PAGE0,A
MOV COM,#40H
ACALL PRR0 ;写指令代码子程序(右)
CCW_7:
DJNZ COUNT,CCW_4
CCW_09:
MOV A,PAGE0
JB ACC.7,CCW_9
INC A
SETB ACC.7
ANL A,#0CFH
MOV PAGE0,A
MOV CODE0,#10H
LJMP CCW_1
CCW_9:
RET
;=================================================
PRL0: NOP
RET
PRL1: NOP
RET
PRL2: NOP
RET
;=============================
;写指令代码子程序(左)
PRM0: CLR CSA
SETB CSB
CLR D_I
SETB R_W
PRM01: MOV P0,#0FFH
SETB E
MOV A,P0
CLR E
JB ACC.7,PRM01
CLR R_W
MOV P0,COM
SETB E
CLR E
RET
;===============================
;写显示数据子程序(左)
PRM1: CLR CSA
SETB CSB
CLR D_I
SETB R_W
PRM11: MOV P1,#0FFH
SETB E
MOV A,P0
CLR E
JB ACC.7,PRM11
SETB D_I
CLR R_W
MOV P0,DAT
SETB E
CLR E
RET
;=============================
;写指令代码子程序(右)
PRR0: CLR CSB
SETB CSA
CLR D_I
SETB R_W
PRR01: MOV P1,#0FFH
SETB E
MOV A,P0
CLR E
JB ACC.7,PRR01
CLR R_W
MOV P0,COM
SETB E
CLR E
RET
;===============================
;写显示数据子程序(右)
PRR1: CLR CSB
SETB CSA
CLR D_I
SETB R_W
PRR11: MOV P1,#0FFH
SETB E
MOV A,P0
CLR E
JB ACC.7,PRR11
SETB D_I
CLR R_W
MOV P0,DAT
SETB E
CLR E
RET
;=============================
;================================
;初始化子程序
INT: MOV COM,#0C0H ;设置显示起始行为第一行
ACALL PRM0
ACALL PRR0
MOV COM,#3FH ;开显示设置
ACALL PRM0
ACALL PRR0
RET
;================================
;清屏子程序
CLEAR: MOV R4,#00H
CLEAR1:
MOV A,R4
ORL A,#0B8H
MOV COM,A
ACALL PRM0
ACALL PRR0
MOV COM,#40H
ACALL PRM0
ACALL PRR0
MOV R3,#40H
CLEAR2:
MOV DAT,#00H
ACALL PRM1
ACALL PRR1
DJNZ R3,CLEAR2
INC R4
CJNE R4,#08H,CLEAR1
RET
;=================================
CCTAB:
;0
;-- 文字: 重 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 08H,08H,0AH,0EAH,0AAH,0AAH,0AAH,0FFH,0A9H,0A9H,0A9H,0E9H,08H,08H,08H,00H
DB 40H,40H,48H,4BH,4AH,4AH,4AH,7FH,4AH,4AH,4AH,4BH,48H,40H,40H,00H
;-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --
;1
;-- 文字: 庆 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 00H,00H,0FCH,44H,44H,44H,44H,0C5H,7EH,0C4H,44H,44H,44H,44H,44H,00H
DB 40H,30H,0FH,40H,20H,10H,0CH,03H,00H,01H,06H,18H,30H,60H,20H,00H
;2
;-- 文字: 市 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 04H,04H,04H,0E4H,24H,24H,25H,0FEH,24H,24H,24H,24H,0E4H,04H,04H,00H
DB 00H,00H,00H,3FH,00H,00H,00H,0FFH,00H,00H,10H,20H,1FH,00H,00H,00H
;3
;-- 文字: 黔 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 0BEH,0AAH,0B2H,0FEH,0B2H,0AAH,0BEH,20H,10H,48H,87H,08H,10H,20H,20H,00H
DB 44H,34H,0CH,33H,0AH,32H,0AH,30H,02H,02H,43H,32H,0EH,02H,00H,00H
;-- 文字: 江 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 10H,60H,01H,0C6H,30H,00H,04H,04H,04H,0FCH,04H,04H,04H,04H,00H,00H
DB 04H,04H,7EH,01H,20H,20H,20H,20H,20H,3FH,20H,20H,20H,20H,20H,00H
;-- 文字: 乌 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 00H,00H,00H,0FEH,04H,04H,06H,05H,44H,84H,7EH,04H,00H,00H,00H,00H
DB 00H,08H,08H,09H,09H,09H,09H,09H,09H,09H,29H,49H,81H,7FH,00H,00H
;-- 文字: 江 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 10H,60H,01H,0C6H,30H,00H,04H,04H,04H,0FCH,04H,04H,04H,04H,00H,00H
DB 04H,04H,7EH,01H,20H,20H,20H,20H,20H,3FH,20H,20H,20H,20H,20H,00H
;-- 文字: 电 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 00H,00H,0F8H,48H,48H,48H,48H,0FFH,48H,48H,48H,48H,0F8H,00H,00H,00H
DB 00H,00H,0FH,04H,04H,04H,04H,3FH,44H,44H,44H,44H,4FH,40H,70H,00H
;-- 文字: 力 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 00H,10H,10H,10H,10H,10H,10H,0FFH,10H,10H,10H,10H,10H,0F0H,00H,00H
DB 00H,00H,80H,40H,20H,18H,06H,01H,00H,00H,40H,80H,40H,3FH,00H,00H
;-- 文字: 集 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 00H,10H,08H,0FCH,57H,54H,54H,54H,0FDH,56H,54H,54H,54H,00H,00H,00H
DB 00H,44H,44H,25H,25H,15H,0DH,0FFH,05H,0DH,15H,25H,65H,25H,04H,00H
;-- 文字: 团 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 00H,0FEH,02H,12H,12H,12H,92H,72H,0FEH,12H,12H,12H,02H,0FEH,00H,00H
DB 00H,0FFH,48H,44H,42H,41H,50H,60H,5FH,40H,40H,40H,40H,0FFH,00H,00H
;-- 文字: 调 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 20H,21H,0EEH,04H,00H,00H,0FFH,29H,0A9H,0BFH,0A9H,0A9H,01H,0FFH,00H,00H
DB 00H,00H,1FH,88H,44H,30H,0FH,00H,0FH,04H,04H,4FH,80H,7FH,00H,00H
;-- 文字: 度 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 00H,00H,0FCH,04H,24H,24H,0FCH,0A5H,0A6H,0A4H,0FCH,24H,24H,24H,04H,00H
DB 80H,60H,1FH,80H,80H,42H,46H,2AH,12H,12H,2AH,26H,42H,0C0H,40H,00H
;-- 文字: 中 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 00H,00H,0FCH,08H,08H,08H,08H,0FFH,08H,08H,08H,08H,0FCH,08H,00H,00H
DB 00H,00H,07H,02H,02H,02H,02H,0FFH,02H,02H,02H,02H,07H,00H,00H,00H
;-- 文字: 心 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 00H,80H,00H,00H,0F0H,00H,01H,02H,1CH,08H,00H,40H,80H,00H,00H,00H
DB 04H,03H,00H,00H,3FH,40H,40H,40H,40H,40H,40H,78H,00H,07H,02H,00H
;-- 文字: 通 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 40H,41H,0C6H,00H,00H,0F2H,52H,52H,56H,0FAH,5AH,56H,0F2H,00H,00H,00H
DB 40H,20H,1FH,20H,40H,5FH,42H,42H,42H,5FH,4AH,52H,4FH,40H,40H,00H
;-- 文字: 讯 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 20H,21H,2EH,0E4H,00H,42H,42H,0FEH,42H,42H,42H,02H,0FEH,00H,00H,00H
DB 00H,00H,00H,7FH,20H,10H,00H,7FH,00H,00H,00H,00H,3FH,40H,38H,00H
;-- 文字: 自 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 00H,00H,00H,0F8H,48H,48H,4CH,4BH,4AH,48H,48H,48H,0F8H,00H,00H,00H
DB 00H,00H,00H,0FFH,44H,44H,44H,44H,44H,44H,44H,44H,0FFH,00H,00H,00H
;-- 文字: 动 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 20H,24H,24H,0E4H,24H,24H,24H,20H,10H,10H,0FFH,10H,10H,0F0H,00H,00H
DB 08H,1CH,0BH,08H,0CH,05H,4EH,24H,10H,0CH,03H,20H,40H,3FH,00H,00H
;-- 文字: 化 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 80H,40H,20H,0F8H,07H,02H,00H,00H,0FFH,0C0H,60H,30H,1CH,08H,00H,00H
DB 00H,00H,00H,7FH,00H,04H,02H,01H,3FH,40H,40H,40H,40H,78H,00H,00H
;-- 文字: 单 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 00H,00H,0F8H,28H,29H,2EH,2AH,0F8H,28H,2CH,2BH,2AH,0F8H,00H,00H,00H
DB 08H,08H,0BH,09H,09H,09H,09H,0FFH,09H,09H,09H,09H,0BH,08H,08H,00H
;-- 文字: 片 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 00H,00H,00H,0FEH,10H,10H,10H,10H,10H,1FH,10H,10H,10H,18H,10H,00H
DB 80H,40H,30H,0FH,01H,01H,01H,01H,01H,01H,01H,0FFH,00H,00H,00H,00H
;-- 文字: 机 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 08H,08H,0C8H,0FFH,48H,88H,08H,00H,0FEH,02H,02H,02H,0FEH,00H,00H,00H
DB 04H,03H,00H,0FFH,00H,41H,30H,0CH,03H,00H,00H,00H,3FH,40H,78H,00H
;-- 文字: 开 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 40H,42H,42H,42H,42H,0FEH,42H,42H,42H,42H,0FEH,42H,42H,42H,42H,00H
DB 00H,40H,20H,10H,0CH,03H,00H,00H,00H,00H,7FH,00H,00H,00H,00H,00H
;-- 文字: 发 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 00H,10H,3EH,10H,10H,0F0H,9FH,90H,90H,92H,94H,1CH,10H,10H,10H,00H
DB 40H,20H,10H,88H,87H,41H,46H,28H,10H,28H,27H,40H,0C0H,40H,00H,00H
;25
;-- 文字: L --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 008H,0F8H,008H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 020H,03FH,020H,020H,020H,020H,030H,000H,000H,000H,000H,000H,000H,000H,000H,000H
;26
;-- 文字: C --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 0C0H,030H,008H,008H,008H,008H,038H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 007H,018H,020H,020H,020H,010H,008H,000H,000H,000H,000H,000H,000H,000H,000H,000H
;27
;-- 文字: D --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 008H,0F8H,008H,008H,008H,010H,0E0H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 020H,03FH,020H,020H,020H,010H,00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
;28
;-- 文字: 演 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 010H,021H,086H,060H,000H,00CH,0D4H,054H,055H,0F6H,054H,054H,0D4H,00CH,004H,000H
DB 004H,0FCH,003H,000H,000H,000H,08FH,069H,009H,00FH,009H,029H,0CFH,000H,000H,000H
;29
;-- 文字: 示 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 000H,020H,020H,022H,022H,022H,022H,0E2H,022H,022H,022H,022H,022H,020H,020H,000H
DB 010H,008H,004H,003H,000H,040H,080H,07FH,000H,000H,001H,002H,00CH,018H,000H,000H
;30
;-- 文字: 器 --
;-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --
DB 040H,040H,04FH,049H,049H,0C9H,0CFH,070H,0C0H,0CFH,049H,059H,069H,04FH,000H,000H
DB 002H,002H,07EH,045H,045H,044H,07CH,000H,07CH,044H,045H,045H,07EH,006H,002H,000H
END