共2条
1/1 1 跳转至页
HS12232,LCD 求助: 请好心人帮忙看下HS12232-9汉字LCD的3线程序问题
问
先给个我注解后商家提供的51汇编程序
;This program is for 12232F,12864-12,12864M Serial test
; RS--------P3.0
; R/W-------P3.1
; E---------P3.2
; DB0~7-----P1
CS EQU P3.0;片选(串行) 0:禁止 1:允许
SID EQU P3.1;输入串行数据(串行)
CLK EQU P3.2;输入串行脉冲(串行)
PSB EQU P3.3;控制界面 0:串行 1:并行8/4 位
ORG 0000H
AJMP START
; ORG 0003H
; LCALL PAUSE
ORG 0100h
START:
; MOV IE,#81H ;EXT. INT0 PERMIT
; MOV IP,#01H ;INT0 IS FIRST INT. LEVEL
; MOV TCON,#00H ;TIMER/COUNTER CONTROLER INIT.
MOV SP, #67H
CLR PSB;选择串行工作模式
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL SETUP;LCD初始化设置
LCALL DEF_CHAR;自定义字符显示
/*---------------------------------------------------
显示4行CGRAM1字符
----------------------------------------------------*/
MOV A,#80H
LCALL WRITE_COM;发送设定DDRAM地址0x00命令
/*---------------------------------------------------
显示第一行CGRAM1字符
----------------------------------------------------*/
MOV R3,#8
TEST11:
MOV DPTR,#CGRAM1 ;CGRAM TEST
LCALL WRITE_CGRAM
DJNZ R3,TEST11
MOV A,#90H
LCALL WRITE_COM;发送设定DDRAM地址0x10命令
/*---------------------------------------------------
显示第二行CGRAM1字符
----------------------------------------------------*/
MOV R3,#8
TEST12:
MOV DPTR,#CGRAM1
LCALL WRITE_CGRAM
DJNZ R3,TEST12
MOV A,#88H
LCALL WRITE_COM;发送设定DDRAM地址0x08命令
/*---------------------------------------------------
显示第三行CGRAM1字符
----------------------------------------------------*/
MOV R3,#8
TEST13:
MOV DPTR,#CGRAM1
LCALL WRITE_CGRAM
DJNZ R3,TEST13
MOV A,#98H
LCALL WRITE_COM;发送设定DDRAM地址0x18命令
/*---------------------------------------------------
显示第四行CGRAM1字符
----------------------------------------------------*/
MOV R3,#8
TEST14:
MOV DPTR,#CGRAM1
LCALL WRITE_CGRAM
DJNZ R3,TEST14
/*---------------------------------------------------
CGRAM1字符显示等待延时5秒
----------------------------------------------------*/
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
/*---------------------------------------------------
显示4行CGRAM2字符
----------------------------------------------------*/
MOV A,#80H
LCALL WRITE_COM;发送设定DDRAM地址0x00命令
/*---------------------------------------------------
显示第一行CGRAM2字符
----------------------------------------------------*/
MOV R3,#8
TEST21:
MOV DPTR,#CGRAM2
LCALL WRITE_CGRAM
DJNZ R3,TEST21
MOV A,#90H
LCALL WRITE_COM;发送设定DDRAM地址0x10命令
/*---------------------------------------------------
显示第二行CGRAM2字符
----------------------------------------------------*/
MOV R3,#8
TEST22:
MOV DPTR,#CGRAM2
LCALL WRITE_CGRAM
DJNZ R3,TEST22
MOV A,#88H
LCALL WRITE_COM;发送设定DDRAM地址0x08命令
/*---------------------------------------------------
显示第三行CGRAM2字符
----------------------------------------------------*/
MOV R3,#8
TEST23:
MOV DPTR,#CGRAM2
LCALL WRITE_CGRAM
DJNZ R3,TEST23
MOV A,#98H
LCALL WRITE_COM;发送设定DDRAM地址0x18命令
/*---------------------------------------------------
显示第四行CGRAM2字符
----------------------------------------------------*/
MOV R3,#8
TEST24:
MOV DPTR,#CGRAM2
LCALL WRITE_CGRAM
DJNZ R3,TEST24
/*---------------------------------------------------
CGRAM2字符显示等待延时
----------------------------------------------------*/
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
/*---------------------------------------------------
显示4行CGRAM3字符
----------------------------------------------------*/
MOV A,#80H
LCALL WRITE_COM;发送设定DDRAM地址0x00命令
/*---------------------------------------------------
显示第一行CGRAM3字符
----------------------------------------------------*/
MOV R3,#8
TEST31:
MOV DPTR,#CGRAM3
LCALL WRITE_CGRAM
DJNZ R3,TEST31
MOV A,#90H
LCALL WRITE_COM;发送设定DDRAM地址0x10命令
/*---------------------------------------------------
显示第二行CGRAM3字符
----------------------------------------------------*/
MOV R3,#8
TEST32:
MOV DPTR,#CGRAM3
LCALL WRITE_CGRAM
DJNZ R3,TEST32
MOV A,#88H
LCALL WRITE_COM;发送设定DDRAM地址0x08命令
/*---------------------------------------------------
显示第三行CGRAM3字符
----------------------------------------------------*/
MOV R3,#8
TEST33:
MOV DPTR,#CGRAM3
LCALL WRITE_CGRAM
DJNZ R3,TEST33
MOV A,#98H
LCALL WRITE_COM;发送设定DDRAM地址0x18命令
/*---------------------------------------------------
显示第四行CGRAM3字符
----------------------------------------------------*/
MOV R3,#8
TEST34:
MOV DPTR,#CGRAM3
LCALL WRITE_CGRAM
DJNZ R3,TEST34
/*---------------------------------------------------
CGRAM3字符显示等待延时
----------------------------------------------------*/
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
/*---------------------------------------------------
显示4行CGRAM4字符
----------------------------------------------------*/
MOV A,#80H
LCALL WRITE_COM;发送设定DDRAM地址0x00命令
/*---------------------------------------------------
显示第一行CGRAM4字符
----------------------------------------------------*/
MOV R3,#8
TEST41:
MOV DPTR,#CGRAM4
LCALL WRITE_CGRAM
DJNZ R3,TEST41
MOV A,#90H
LCALL WRITE_COM;发送设定DDRAM地址0x10命令
/*---------------------------------------------------
显示第二行CGRAM4字符
----------------------------------------------------*/
MOV R3,#8
TEST42:
MOV DPTR,#CGRAM4
LCALL WRITE_CGRAM
DJNZ R3,TEST42
MOV A,#88H
LCALL WRITE_COM;发送设定DDRAM地址0x08命令
/*---------------------------------------------------
显示第三行CGRAM4字符
----------------------------------------------------*/
MOV R3,#8
TEST43:
MOV DPTR,#CGRAM4
LCALL WRITE_CGRAM
DJNZ R3,TEST43
MOV A,#98H
LCALL WRITE_COM;发送设定DDRAM地址0x18命令
/*---------------------------------------------------
显示第四行CGRAM4字符
----------------------------------------------------*/
MOV R3,#8
TEST44:
MOV DPTR,#CGRAM4
LCALL WRITE_CGRAM
DJNZ R3,TEST44
/*---------------------------------------------------
CGRAM4字符显示等待延时
----------------------------------------------------*/
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
/*---------------------------------------------------
显示4行英文字符
----------------------------------------------------*/
MOV A,#80H;第一行英文字符0x80~0x87
LCALL WRITE_COM;发送设定DDRAM地址0x00命令
MOV DPTR,#ETAB;DB ' LCDINLINE.COM! '
/*---------------------------------------------------
显示第一行英文字符' LCDINLINE.COM! '
----------------------------------------------------*/
LCALL WRITE_ASCII;显示16个英文字符
MOV A,#90H;第二行英文字符0x90~0x97
LCALL WRITE_COM;发送设定DDRAM地址0x10命令
MOV DPTR,#ETAB+16;DB 'WELCOME TO HERE!'
/*---------------------------------------------------
显示第二行英文字符'WELCOME TO HERE!'
----------------------------------------------------*/
LCALL WRITE_ASCII;显示16个英文字符
MOV A,#88H;第三行英文字符0x88~0x8F
LCALL WRITE_COM;发送设定DDRAM地址0x08命令
MOV DPTR,#TABLE1;DB 'ABCDEFGHIJKLMNOP'
/*---------------------------------------------------
显示第三行英文字符'ABCDEFGHIJKLMNOP'
----------------------------------------------------*/
LCALL WRITE_ASCII;显示16个英文字符
MOV A,#98H;第一行英文字符0x98~0x9F
LCALL WRITE_COM;发送设定DDRAM地址0x18命令
MOV DPTR,#TABLE1+16;DB '0123456789!
;This program is for 12232F,12864-12,12864M Serial test
; RS--------P3.0
; R/W-------P3.1
; E---------P3.2
; DB0~7-----P1
CS EQU P3.0;片选(串行) 0:禁止 1:允许
SID EQU P3.1;输入串行数据(串行)
CLK EQU P3.2;输入串行脉冲(串行)
PSB EQU P3.3;控制界面 0:串行 1:并行8/4 位
ORG 0000H
AJMP START
; ORG 0003H
; LCALL PAUSE
ORG 0100h
START:
; MOV IE,#81H ;EXT. INT0 PERMIT
; MOV IP,#01H ;INT0 IS FIRST INT. LEVEL
; MOV TCON,#00H ;TIMER/COUNTER CONTROLER INIT.
MOV SP, #67H
CLR PSB;选择串行工作模式
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL SETUP;LCD初始化设置
LCALL DEF_CHAR;自定义字符显示
/*---------------------------------------------------
显示4行CGRAM1字符
----------------------------------------------------*/
MOV A,#80H
LCALL WRITE_COM;发送设定DDRAM地址0x00命令
/*---------------------------------------------------
显示第一行CGRAM1字符
----------------------------------------------------*/
MOV R3,#8
TEST11:
MOV DPTR,#CGRAM1 ;CGRAM TEST
LCALL WRITE_CGRAM
DJNZ R3,TEST11
MOV A,#90H
LCALL WRITE_COM;发送设定DDRAM地址0x10命令
/*---------------------------------------------------
显示第二行CGRAM1字符
----------------------------------------------------*/
MOV R3,#8
TEST12:
MOV DPTR,#CGRAM1
LCALL WRITE_CGRAM
DJNZ R3,TEST12
MOV A,#88H
LCALL WRITE_COM;发送设定DDRAM地址0x08命令
/*---------------------------------------------------
显示第三行CGRAM1字符
----------------------------------------------------*/
MOV R3,#8
TEST13:
MOV DPTR,#CGRAM1
LCALL WRITE_CGRAM
DJNZ R3,TEST13
MOV A,#98H
LCALL WRITE_COM;发送设定DDRAM地址0x18命令
/*---------------------------------------------------
显示第四行CGRAM1字符
----------------------------------------------------*/
MOV R3,#8
TEST14:
MOV DPTR,#CGRAM1
LCALL WRITE_CGRAM
DJNZ R3,TEST14
/*---------------------------------------------------
CGRAM1字符显示等待延时5秒
----------------------------------------------------*/
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
/*---------------------------------------------------
显示4行CGRAM2字符
----------------------------------------------------*/
MOV A,#80H
LCALL WRITE_COM;发送设定DDRAM地址0x00命令
/*---------------------------------------------------
显示第一行CGRAM2字符
----------------------------------------------------*/
MOV R3,#8
TEST21:
MOV DPTR,#CGRAM2
LCALL WRITE_CGRAM
DJNZ R3,TEST21
MOV A,#90H
LCALL WRITE_COM;发送设定DDRAM地址0x10命令
/*---------------------------------------------------
显示第二行CGRAM2字符
----------------------------------------------------*/
MOV R3,#8
TEST22:
MOV DPTR,#CGRAM2
LCALL WRITE_CGRAM
DJNZ R3,TEST22
MOV A,#88H
LCALL WRITE_COM;发送设定DDRAM地址0x08命令
/*---------------------------------------------------
显示第三行CGRAM2字符
----------------------------------------------------*/
MOV R3,#8
TEST23:
MOV DPTR,#CGRAM2
LCALL WRITE_CGRAM
DJNZ R3,TEST23
MOV A,#98H
LCALL WRITE_COM;发送设定DDRAM地址0x18命令
/*---------------------------------------------------
显示第四行CGRAM2字符
----------------------------------------------------*/
MOV R3,#8
TEST24:
MOV DPTR,#CGRAM2
LCALL WRITE_CGRAM
DJNZ R3,TEST24
/*---------------------------------------------------
CGRAM2字符显示等待延时
----------------------------------------------------*/
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
/*---------------------------------------------------
显示4行CGRAM3字符
----------------------------------------------------*/
MOV A,#80H
LCALL WRITE_COM;发送设定DDRAM地址0x00命令
/*---------------------------------------------------
显示第一行CGRAM3字符
----------------------------------------------------*/
MOV R3,#8
TEST31:
MOV DPTR,#CGRAM3
LCALL WRITE_CGRAM
DJNZ R3,TEST31
MOV A,#90H
LCALL WRITE_COM;发送设定DDRAM地址0x10命令
/*---------------------------------------------------
显示第二行CGRAM3字符
----------------------------------------------------*/
MOV R3,#8
TEST32:
MOV DPTR,#CGRAM3
LCALL WRITE_CGRAM
DJNZ R3,TEST32
MOV A,#88H
LCALL WRITE_COM;发送设定DDRAM地址0x08命令
/*---------------------------------------------------
显示第三行CGRAM3字符
----------------------------------------------------*/
MOV R3,#8
TEST33:
MOV DPTR,#CGRAM3
LCALL WRITE_CGRAM
DJNZ R3,TEST33
MOV A,#98H
LCALL WRITE_COM;发送设定DDRAM地址0x18命令
/*---------------------------------------------------
显示第四行CGRAM3字符
----------------------------------------------------*/
MOV R3,#8
TEST34:
MOV DPTR,#CGRAM3
LCALL WRITE_CGRAM
DJNZ R3,TEST34
/*---------------------------------------------------
CGRAM3字符显示等待延时
----------------------------------------------------*/
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
/*---------------------------------------------------
显示4行CGRAM4字符
----------------------------------------------------*/
MOV A,#80H
LCALL WRITE_COM;发送设定DDRAM地址0x00命令
/*---------------------------------------------------
显示第一行CGRAM4字符
----------------------------------------------------*/
MOV R3,#8
TEST41:
MOV DPTR,#CGRAM4
LCALL WRITE_CGRAM
DJNZ R3,TEST41
MOV A,#90H
LCALL WRITE_COM;发送设定DDRAM地址0x10命令
/*---------------------------------------------------
显示第二行CGRAM4字符
----------------------------------------------------*/
MOV R3,#8
TEST42:
MOV DPTR,#CGRAM4
LCALL WRITE_CGRAM
DJNZ R3,TEST42
MOV A,#88H
LCALL WRITE_COM;发送设定DDRAM地址0x08命令
/*---------------------------------------------------
显示第三行CGRAM4字符
----------------------------------------------------*/
MOV R3,#8
TEST43:
MOV DPTR,#CGRAM4
LCALL WRITE_CGRAM
DJNZ R3,TEST43
MOV A,#98H
LCALL WRITE_COM;发送设定DDRAM地址0x18命令
/*---------------------------------------------------
显示第四行CGRAM4字符
----------------------------------------------------*/
MOV R3,#8
TEST44:
MOV DPTR,#CGRAM4
LCALL WRITE_CGRAM
DJNZ R3,TEST44
/*---------------------------------------------------
CGRAM4字符显示等待延时
----------------------------------------------------*/
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
LCALL DELAY;延时150mS
/*---------------------------------------------------
显示4行英文字符
----------------------------------------------------*/
MOV A,#80H;第一行英文字符0x80~0x87
LCALL WRITE_COM;发送设定DDRAM地址0x00命令
MOV DPTR,#ETAB;DB ' LCDINLINE.COM! '
/*---------------------------------------------------
显示第一行英文字符' LCDINLINE.COM! '
----------------------------------------------------*/
LCALL WRITE_ASCII;显示16个英文字符
MOV A,#90H;第二行英文字符0x90~0x97
LCALL WRITE_COM;发送设定DDRAM地址0x10命令
MOV DPTR,#ETAB+16;DB 'WELCOME TO HERE!'
/*---------------------------------------------------
显示第二行英文字符'WELCOME TO HERE!'
----------------------------------------------------*/
LCALL WRITE_ASCII;显示16个英文字符
MOV A,#88H;第三行英文字符0x88~0x8F
LCALL WRITE_COM;发送设定DDRAM地址0x08命令
MOV DPTR,#TABLE1;DB 'ABCDEFGHIJKLMNOP'
/*---------------------------------------------------
显示第三行英文字符'ABCDEFGHIJKLMNOP'
----------------------------------------------------*/
LCALL WRITE_ASCII;显示16个英文字符
MOV A,#98H;第一行英文字符0x98~0x9F
LCALL WRITE_COM;发送设定DDRAM地址0x18命令
MOV DPTR,#TABLE1+16;DB '0123456789!
共2条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
与电子爱好者谈读图二被打赏50分 | |
【FRDM-MCXN947评测】Core1适配运行FreeRtos被打赏50分 | |
【FRDM-MCXN947评测】双核调试被打赏50分 | |
【CPKCORRA8D1B评测】---移植CoreMark被打赏50分 | |
【CPKCORRA8D1B评测】---打开硬件定时器被打赏50分 | |
【FRDM-MCXA156评测】4、CAN loopback模式测试被打赏50分 | |
【CPKcorRA8D1评测】--搭建初始环境被打赏50分 | |
【FRDM-MCXA156评测】3、使用FlexIO模拟UART被打赏50分 | |
【FRDM-MCXA156评测】2、rt-thread MCXA156 BSP制作被打赏50分 | |
【FRDM-MCXN947评测】核间通信MUTEX被打赏50分 |