MS12864F图形点阵液晶显示模块使用手册 下载本文

DJNZ R5,DELAY1 RET

;**********************************************8 INT:

PUSH ACC PUSH DPH PUSH DPL PUSH PSW SJMP $ CLR IE0 POP PSW POP DPL POP DPH POP ACC

RETI

;***************************************************** MAIN:

MOV SP,#20H MOV P3,#0FFH SETB EA SETB EX0 SETB IT0

MOV COMMAND,#90H LCALL WRITE_COMMAND LCALL MS40

MOV DATA2,#00H LCALL WRITE_DATA MOV DATA2,#00H LCALL WRITE_DATA

MOV COMMAND,#40H ;文本显示区首地址设置 LCALL WRITE_COMMAND ; MOV DATA2,#20H MOV DATA2,#10H LCALL WRITE_DATA MOV DATA2,#00H

LCALL WRITE_DATA

MOV COMMAND,#41H ;文本显示区宽度设置 LCALL WRITE_COMMAND

MOV DATA2,#00H LCALL WRITE_DATA MOV DATA2,#08H LCALL WRITE_DATA

MOV COMMAND,#42H ;图形显示区首地址设置 LCALL WRITE_COMMAND

MOV DATA2,#10H LCALL WRITE_DATA MOV DATA2,#00H LCALL WRITE_DATA

MOV COMMAND,#43H ;图形显示宽度设置 LCALL WRITE_COMMAND

; MOV COMMAND,#0A1H ;光标形状 ; LCALL WRITE_COMMAND

MOV COMMAND,#80H ;逻辑或,用CGROM LCALL WRITE_COMMAND

MOV COMMAND,#9CH ; 启动文本.图形.光标显示 LCALL WRITE_COMMAND

;***************************************888 ;显示全屏

MOV DATA2,#00H LCALL WRITE_DATA MOV DATA2,#00H LCALL WRITE_DATA MOV COMMAND,#24H LCALL WRITE_COMMAND MOV R3,#00H

MOV COMMAND,#0B0H LCALL WRITE_COMMAND MOV R4,#20H YY1:

NOP

YY: MOV A,#0FFH MOV DATA2,A

LCALL WRITE_DATA DJNZ R3,YY DJNZ R4,YY1

MOV COMMAND,#0B2H LCALL WRITE_COMMAND LCALL MS40

;******************************************* CLEAR1:

MOV DATA2,#00H LCALL WRITE_DATA MOV DATA2,#00H LCALL WRITE_DATA

MOV COMMAND,#24H ;显示地址设置 LCALL WRITE_COMMAND MOV R3,#00H MOV R4,#20H

MOV COMMAND,#0B0H ;自动写入 LCALL WRITE_COMMAND M1:

NOP

M: MOV A,#00H MOV DATA2,A

LCALL WRITE_DATA DJNZ R3,M DJNZ R4,M1

MOV COMMAND,#0B2H ;推出自动写入 LCALL WRITE_COMMAND

; ****************************************

MOV DATA2,#00H LCALL WRITE_DATA MOV DATA2,#00H LCALL WRITE_DATA

MOV COMMAND,#24H ;显示地址设置 LCALL WRITE_COMMAND

MOV COMMAND,#9CH LCALL WRITE_COMMAND MOV DATA2,#05H LCALL WRITE_DATA MOV DATA2,#03H LCALL WRITE_DATA MOV COMMAND,#21H LCALL WRITE_COMMAND

;显示字库

MOV R3,#00H MOV R4,#7FH

MOV COMMAND,#0B0H ;自动写入 LCALL WRITE_COMMAND

MOV A,#0FFH ;写入英文字库 L: INC A

MOV DATA2,A

LCALL WRITE_DATA DJNZ R4,L

MOV COMMAND,#0B2H ;退出自动写入 LCALL WRITE_COMMAND LCALL DELAY

;###########################################

; 写CGROM 80H

MOV DATA2,#03H LCALL WRITE_DATA MOV DATA2,#00H LCALL WRITE_DATA MOV COMMAND,#22H LCALL WRITE_COMMAND

MOV DATA2,#00H LCALL WRITE_DATA MOV DATA2,#1CH LCALL WRITE_DATA MOV COMMAND,#24H LCALL WRITE_COMMAND

MOV R2,#2 MOV R0,#0FFH

MOV COMMAND,#0B0H LCALL WRITE_COMMAND MOV DPTR,#TEST LL2: NOP

LL: CLR A

MOVC A, @A+DPTR MOV DATA2,A

LCALL WRITE_DATA INC DPTR SETB P1.5 DJNZ R0,LL

DJNZ R2,LL2

MOV DATA2,#0B2H LCALL WRITE_DATA

;############################################# MOV DATA2,#00H LCALL WRITE_DATA MOV DATA2,#00H LCALL WRITE_DATA

MOV COMMAND,#24H LCALL WRITE_COMMAND

MOV COMMAND,#0B0H LCALL WRITE_COMMAND MOV R2,#2 TIAO1: MOV R1,#255

MMM: MOV DATA2,#80H LCALL WRITE_DATA DJNZ R1,MMM DJNZ R2,TIAO1

MOV COMMAND,#0B2H LCALL WRITE_COMMAND LCALL DELAY

MOV COMMAND,#0B0H LCALL WRITE_COMMAND MOV DATA2,#00H LCALL WRITE_DATA MOV DATA2,#00H LCALL WRITE_DATA

MOV COMMAND,#24H LCALL WRITE_COMMAND MOV R2,#2 TIAO2: MOV R1,#255

MMM1: MOV DATA2,#81H LCALL WRITE_DATA DJNZ R1,MMM1 DJNZ R2,TIAO2

MOV COMMAND,#0B2H LCALL WRITE_COMMAND

;显示地址设置;显示地址设置