12864液晶屏显示时间,汇编语言
12864中文字库液晶模块使用说明书
12864中文字库液晶模块使用说明书第 1 页共16 页一、12864液晶显示模块概述1. 12864液晶显示模块是128×64点阵的汉字图形型液晶显示模块,可显示汉字及图形,内置国标GB2312码简体中文字库(16X16点阵)、128个字符(8X16点阵)及64X256点阵显示RAM(GDRAM)。
可与CPU 直接接口,提供两种界面来连接微处理机:8-位并行及串行两种连接方式。
具有多种功能:光标显示、画面移位、睡眠模式等。
2. 外观尺寸:93×70mm(4X8C), 84×44mm(2X8C),110×65mm(2x8 C _2), 116×39mm(2X10),180×65mm(4X16A)3. 视域尺寸:73×39mm(4X8C), 78×25mm(2x8 C _2), 70×20mm(2X8C),85×20mm(2X10), 132×39mm(4X16A),补充说明:外观尺寸可根据用户的要求进行适度调整。
二、模块引脚说明1)表—1:(128X32)、(160X32)模块引脚说明引脚名称 方向 说明 引脚名称方向 说明1 VSS - GND(0V) 11 DB4 I/O 数据42 VDD - Supply Voltage For Logic (+5v) 12 DB5 I/O 数据53 VO - Supply Voltage For LCD (悬空)13 DB6 I/O 数据64 RS(CS) H/L H: Data L: Instruction Code 14 DB7 I/O 数据75 R/W(STD) H/L H: Read L: Write15 PSB H/L 16032此脚为:RESET脚 6 E(SCLK) H,H/L Enable Signal7 DB0 I/O 数据0 16 /RST H/L 16032此脚为空8 DB1 I/O 数据1 17 LEDK - 16032此脚为A9 DB2 I/O 数据2 18 LEDA - 16032此脚为K10 DB3 I/O 数据3 注:以上K为负,A为正4)表—4:(256X64)引脚说明引脚名称 方向 说明引脚名称 方向 说明 1 FG - FRAME GROUND 11 DB0 I/O 数据0 2 VSS - GND(0V)12 DB1 I/O 数据1 3 VDD - Supply Voltage For Logic (+5v) 13 DB2 I/O 数据2 4 NC - 空脚14 DB3 I/O 数据3 5 R/W H/L H: Read L: Write 15 DB4 I/O 数据4 6 E1 H,H/L Enable Signal1 16 DB5 I/O 数据5 7 E2 H,H/L Enable Signal217 DB6 I/O 数据6 8 RS H/L H: Data L: Instruction Code 18 DB7 I/O 数据7 9 NC - 空脚19 NC - 空脚 10 /RST H/L Reset Signal 低电平有效 20 NC - 空脚注 K背光源负极(LED-OV)A背光源正极(LED+5V)三、12864液晶硬件接口1、逻辑工作电压(VDD):4.5~5.5V2、电源地(GND):0V3、LCD 驱动电压(V0):0~-10V4、工作温度(Ta):0~55℃(常温) / -20~70℃(宽温) 保存温度(Tstg):-10~65℃(常温)5、电气特性见附图1 外部连接图(参考附图2)模块有并行和串行两种连接方法(时序如下): 1、8位并行连接时序图MPU 写资料到模块RSR/WEMPU从模块读出资料RSR/WE2、串行连接时序图CS C LS T3、AC电气特性(TA=25℃ VCC=5V)condition Min. Typ. Max. UnitSYMBOL Characteristics Testfrequency Rf=39KΩ480 540 600 KHz Fosc OSCTIME UNIT PARAMETER SYMBOL MESUREFOR WRITE MODE(WRITING DATA FROM MPU TO ST7920)System cycle time TC 13,000 nsAddress setup time TAS 1,500 nsAddress hold time TAH 1,500 nsData setup time TDSW 1,000 nsData hold time TH 20 nsEnable pulsewidth TPW 1,500 nsEnable rise/fall time TR,TF 25 nsFOR READ MODE(READING DATA FROM ST7920 TO MPU)System cycle time TC 13,000 nsAddress setup time TAS 1,500 nsAddress hold time TAH 1,500 nsData setup time TDDR 1,000 nsData hold time TH 20 ns Enable pulsewidth TPW 1,500 ns Enable rise/fall time TR,TF 25 ns四、用户指令集指令表—2:(RE=1:扩充指令集)指令码指令RS RW DB7 DB6 DB5DB4 DB3 DB2DB1DB0说明执行时间(540KHZ )待命模式 0 0 0 0 0 0 0 0 0 1将DDRAM 填满“20H ”,并且设定DDRAM 的地址计数器(AC )到“00H ” 72us卷动地址或IRAM 地址选择 0 0 0 0 0 0 0 0 1 SR SR=1:允许输入垂直卷动地址 SR=0:允许输入IRAM 地址72us反白选择 0 0 0 0 0 0 0 1 R1 R0选择4行中的任一行作反白显示,并可决定反白与否 72us 睡眠模式0 0 0 0 0 0 1 SL X XSL=1:脱离睡眠模式 SL=0:进入睡眠模式72us扩充功能设定0 0 0 0 1 1 X1REG 0RE=1:扩充指令集动作RE=0:基本指令集动作G=1 :绘图显示ONG=0 :绘图显示OFF72us设定IRAM地址或卷动地址0 0 0 1 AC5AC4 AC3 AC2AC1AC0SR=1:AC5—AC0为垂直卷动地址SR=0:AC3—AC0为ICON IRAM地址72us设定绘图RAM地址0 0 1 AC6 AC5AC4 AC3 AC2AC1AC0设定CGRAM地址到地址计数器(AC)72us备注:1、当模块在接受指令前,微处理顺必须先确认模块内部处于非忙碌状态,即读取BF标志时BF需为0,方可接受新的指令;如果在送出一个指令前并不检查BF标志,那么在前一个指令和这个指令中间必须延迟一段较长的时间,即是等待前一个指令确实执行完成,指令执行的时间请参考指令表中的个别指令说明。
stm32 12864 lcd显示时间和温度
#define BIT_ADDR(addr, bitnum) MEM_ADDR(BITBAND(addr, bitnum))
//IO口地址映射
#define GPIOA_ODR_Addr (GPIOA_BASE+12) //0x4001080C
// DS1302
//-------------------------------------------------------------------------------------------------
#define ds1302clk GPIO_Pin_12
#define CS_H GPIOC->BSRR=GPIO_Pin_8
#define CS_L GPIOC->BRR=GPIO_Pin_8
#define SCLK_H GPIOC->BSRR=GPIO_Pin_6
#define SCLK_L GPIOC->BRR=GPIO_Pin_6
#include "stm32f10x.h"
#include "stdio.h"
//-------------------------------------------------------------------------------------------------
#define KEY0 GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_5)//读取按键0
#define ds1302dat GPIO_Pin_13
12864中文图形点阵液晶显示模块使用说明书
72us
读出 RAM
的值
1 1 D7
D6
D5
D4
D3
D2
D1
D0
从 内 部 RAM 读 取 数 据 (DDRAM/CGRAM/GDRAM)
72us
指令表 2:(RE=1:扩充指令集)
指令
指令码
RS RW DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
说明
执行 时间 (540K HZ)
功能:设定 CGRAM 地址到地址计数器(AC),需确定扩充指令中 SR=0(卷动地址或 RAM 地址选择)
地址
设定 CGRAM 地址到地址计数器(AC)
1 AC5 AC4 AC3 AC2 AC1 AC0 需确定扩充指令中 SR=0(卷动地址或 72us RAM 地址选择)
设定 DDRAM 0 0 1 AC6 AC5 AC4 AC3 AC2 AC1 AC0 设定 DDRAM 地址到地址计数器(AC) 72us
I/O
DB5
I/O
DB6
I/O
DB7
I/O
PSB
I
NC
-
/RST
I
VEE
-
LED+
-
LED-
-
说明
电源地
逻辑电源正(+5V)
LCD 对比度调节电压
并行模式时选择数据或指令
H: 数据 L: 指令
串行模式时选择模块与否
H: 选择 L: 不选择
并行模式时控制读写
H: 读
L: 写
串行模式时输入数据
并行模式时使能端
L
L
L
H
DL
X
RE
X
12864点阵液晶显示器指令
10、写显示数据
CODE:R/WD/IDB7 DB6 DB5DB4DB3 DB2 DB1DB0
L
H
D7
D6
D5
D4
D3
D2
D1
D0
功能:写数据到DD RAM,DD RAM是存储图形显示数据的,写指令执行后Y地址计数器自动加1。D7-D0位数据为1表示显示,数据为0表示不显示。写数据到DD RAM前,要先执行“设置页地址”及“设置列地址”命令。
备注:ST7920控制器的128×64点阵液晶其实原理上等同256×32点阵,第三行对应的DDRAM地址紧接第一行;第四行对应的DDRAM地址紧接第二行。用户在使用行反白功能时,如果第一行反白,第三行必然反白。第二行反白,第四行必然反白。这是正常现象。
9、状态检测忙标志位(StatusBusy 1<<7)
基本指令
1、清除显示(DispClear0x01)
CODE:RSR/WDB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
L
L
L
L
L
L
L
L
L
H
功能:将DDRAM填满“20H”(空格)代码,并且设定DDRAM的地址计数器(AC)为
00H;更新设置进入设定点将I/D设为1,游标右移AC加1。
2、地址归0(HOME0x20)
绘图RAM(GDRAM)
绘图显示RAM提供64×32个位元组的记忆空间,最多可以控制256×64点的二维绘图缓冲空间,在更改绘图RAM时,先连续写入水平与垂直的坐标值,再写入两个8位元的资料到绘图RAM,
而地址计数器(AC)会自动加一;在写入绘图RAM的期间,绘图显示必须关闭,整个写入绘图RAM
12864液晶屏学习使用手册
12864液晶屏学习手册1.液晶模组概览12864A-1汉字图形点阵液晶显示模块,可显示汉字和图形,内置8192个汉字(16X16点矩阵,16 * 8 = 128,16 * 4 = 64,一行,4行只能写8个汉字;),128个字符(8X16点矩阵)和64X256点矩阵显示RAM(GDRAM)。
主要技术参数和显示特性:电源:VDD 3.3V〜+5伏(内置升压电路,无负压);显示内容:128列X第64行(128分)显示颜色:黄绿色显示角度:直接看6:00LCD类型:STN与MCU的接口:8位或4位并行/ 3位串行配置LED背光多种软件功能:光标显示,屏幕移位,自定义字符,睡眠模式等2.尺寸1.尺寸2。
主要尺寸项目标准尺寸单元模子片身体产品113.0X65.0X12.8毫米2.模块引脚说明逻辑工作电压(VDD):4.5〜5.5V电源地(GND):0V穿孔温度(Ta):0〜60°C(常温)/ -20〜75°C(宽温度)三,接口定时模块有两种连接方式:并行和串行(时间如下):8位并行连接时序图MPU将数据写入模块MPU从模块读取数据2,串行连接时序图串行数据传输以三个字节完成:第一个字节:串口控制—格式11111ABCA是数据传输方向控制:H表示从LCD到MCU的数据,L表示从MCU到LCD的数据B是数据类型选择:H表示数据是显示数据,L表示数据是控制指令C固定为0第二字节:(并行)8位数据的高4位—格式DDDD0000第三个字节:(并行)8位数据的低4位—格式0000DDDD串行接口时序参数:(测试条件:T =25℃VDD = 4.5V)备注:1,在模块接受指令之前,微处理器必须首先确认模块不忙,即读取高炉签到时间高炉需要0接受新说明之前;如果你不这样做’t在发送命令之前检查高炉商标,(通常在输入每日命令之前添加延迟)那么上一条指令和该指令之间必须有很长的延迟,也就是等待上一条命令的执行完成,有关命令的执行时间,请参阅命令表中的各个命令描述。
12864显示程序(汇编语言)
ACALL DELAY
ACALL DELAY
LCALL DELAY ;延迟39uS
MOV COM,#06H ;DDRAM的地址计数器(AC)加1
ACALL WRI ;调用写指令子程序
LCALL DELAY ;延迟39uS
MOV A,#8
MOV R3,A
DISP32: MOV R2,A
MOV A,R1
ADD A,#2
MOV R0,A
MOV R1,A
ACALL DELAY1
ACALL DELAY
DJNZ R4,DISP2
;右移显示,时间间隔为1秒
MOV R0,#00H
MOV R1,#00H
MOV R2,#1
MOV R3,#1
DISP4: MOV COM,B
ACALL WRI
ACALL DISP21
MOV R0,#00H
INC R3
MOV A,R3
CJNE A,#9,DISP42
MOV R3,A ;保存显示位数
DISP22: MOV R2,A
DEC B ;取下一次显示首地址,并进行判断
MOV A,B
CJNE A,#8FH,DISP23
INC R3 ;取下一次显示文字个数
MOV A,R3
CJNE A,#9,DISP12 ;判断文字个数是否超过8
MOV A,#8 ;超过8个就定死显示个数
ACALL WRI ;调用写指令子程序
ACALL DELAY ;延时
ACALL DELAY
ACALL DELAY
DJNZ R4,DISP1 ;判断移位显示是否完毕
12864LCD液晶显示屏中文资料
12864LCD液晶显示屏中文资料一、概述二、带中文字库的128X64是一种具有4位/8位并行、2线或3线串行多种接口方式,内部含有国标一级、二级简体中文字库的点阵图形液晶显示模块;其显示分辨率为128×64, 内置8192个16*16点汉字,和128个16*8点ASCII字符集.利用该模块灵活的接口方式和简单、方便的操作指令,可构成全中文人机交互图形界面。
可以显示8×4行16×16点阵的汉字. 也可完成图形显示.低电压低功耗是其又一显著特点。
由该模块构成的液晶显示方案与同类型的图形点阵液晶显示模块相比,不论硬件电路结构或显示程序都要简洁得多,且该模块的价格也略低于相同点阵的图形液晶模块。
三、基本特性:(1)、低电源电压(VDD:+3.0--+5.5V)(2)、显示分辨率:128×64点(3)、内置汉字字库,提供8192个16×16点阵汉字(简繁体可选) (4)、内置 128个16×8点阵字符(5)、2MHZ时钟频率(6)、显示方式:STN、半透、正显(7)、驱动方式:1/32DUTY,1/5BIAS (8)、视角方向:6点(9)、背光方式:侧部高亮白色LED,功耗仅为普通LED的1/5—1/10 (10)、通讯方式:串行、并口可选(11)、内置DC-DC转换电路,无需外加负压(12)、无需片选信号,简化软件设计(13)、工作温度: 0℃ - +55℃ ,存储温度: -20℃ - +60℃模块接口说明:*注释1:如在实际应用中仅使用串口通讯模式,可将PSB接固定低电平,也可以将模块上的J8和“GND”用焊锡短接。
*注释2:模块内部接有上电复位电路,因此在不需要经常复位的场合可将该端悬空。
*注释3:如背光和模块共用一个电源,可以将模块上的JA、JK用焊锡短接。
2.2并行接口*注释1:如在实际应用中仅使用并口通讯模式,可将PSB接固定高电平,也可以将模块上的J8和“VCC”用焊锡短接。
12864液晶显示串行程序(英飞凌xc824)
12864液晶显示串行程序(英飞凌xc824)
先说说我的调试初衷前一阵看实验室的兄弟姐妹们都闲的无聊,就有人DIY 了,有人个BF 做电子时钟,一个液晶30 多,一个12C887 20 多,板子加器件还有单片机算下来少说也有70 大洋。
感觉实在不划算,但是对液晶还是
蛮感兴趣的,一方面熟悉一下串行设备,一方面为以后做准备,毕竟液晶显示
操作起来要比LED 简单,而且能实时显示,到什么时候都能用上。
所以,这
次液晶屏的调试,我就想搜集一些常用的程序,适当的修改,让液晶屏达到拿
来就能用上的目的。
先说说我这次调试的液晶屏,12864,带子库的,蓝色屏幕。
就是这张图了
单片机我选的是英飞凌xc824,新出的哦。
不是有啥特殊偏好,手头就有这个,就先用这个吧,主要是我对这个最小系统板上的触摸按键比较感兴趣。
当
然了,它也有缺点,内存太小,连一个12864 的图片都装不下。
:Q 闲话少说,先从最基本的数据手册开始吧
中显液晶12864.pdf
这是中文资料,因为这种东西已经被使用的多的不能再多了,而且厂家众多,但是有细微差别,比如串行和并行,有的是焊点切换的,有的是软件切换的。
我这个是后者。
刚接线的时候还出了个笑话,太相信实物和datasheet 和对应的了,结果屏幕的背光接反了,幸好没烧。
硬件方面,我选串行是因为它用线少,我很懒的。
:) P1.0 口对应CS,P1.1 口对应SID,P1.2 口对应CLK.
参考时序在datasheet 上写的很清楚有这个当指导思想,照着写程序吧.动手之。
12864代码进化版显示时,分,秒
128*64代码进化版显示时,分,秒显示结果:芯片晶振11.0592#include ;#define uchar unsigned char #define uint unsigned int#define dataport P0//数据口sbit CS1=P2^4;//左显引脚sbit CS2=P2^3;//右显引脚sbit RST=P2^2;//复位引脚sbit rs=P2^7;//数据或指令寄存器引脚sbit rw=P2^6;//读或写操作引脚sbit en=P2^5;//读写时能引脚void delay(unsigned long v); //延时void wcode(uchar c,uchar csl,uchar csr); //写指令void wdata(uchar c,uchar csl,uchar csr); //写数据void set_startline(uchar i);//设置起始行void set_xy(uchar x,uchar y);//设置X,Y方向void dison_off(uchar k);//显示器开或关void reset();//复位void lcd_init();//显示器初始化void lw(uchar x,uchar y,uchar dd);//将数据写入左右半屏void display_hz(uchar xx,uchar yy,uchar n,uchar fb); //显示汉字函数uchar code hz[]; //汉字字摸uchar code asc[];//数字字摸uchar hour1,hour0;uchar minute1,minute0;uchar sec1,sec0;uchar hour=0,minute=0,sec=0;uchar osc=0;void Timer0(void)//设定定时器0 50ms{TMOD = 0x01;TH0 = 0x3C;TL0 = 0x0B0;EA = 1;ET0 = 1;TR0 = 1;}void time0init()interrupt 1//定时器中断执行,时,分,秒计算{TR0=0;osc++;if(osc==20){sec++;osc=0;}if(sec==60){minute++; sec=0;}if(minute==60){hour++;minute=0;}if(hour==24){hour=0;}hour1=hour/10;hour0=hour%10;minute1=minute/10;minute0=minute%10;sec1=sec/10;sec0=sec%10;TH0=0x3c;TL0=0x0B0;EA=1;ET0=1;TF0=0;TR0=1;}#include "12864hh.h"void main(void){lcd_init();delay(1000);Timer0();while(1){display_hz(2,0,0,0); display_hz(4,0,1,0); display_hz(6,0,2,0); display_hz(8,0,3,0); display_hz(10,0,4,0); display_hz(0,4,5,0); display_hz(6,4,6,0); display_hz(12,4,7,0); display_asc(2,4,hour1,0); display_asc(3,4,hour0,0); display_asc(8,4,minute1,0); display_asc(9,4,minute0,0); display_asc(14,4,sec1,0); display_asc(15,4,sec0,0); }delay(60000);}//-------------------------中文字字模------------------------------uchar code hz[]={0x20,0x04,0x20,0x04,0x22,0x42,0x22,0x82,0xFE,0x7F ,0x21,0x01,0x21,0x01,0x20,0x10,0x20,0x10,0xFF,0x08,0x20,0x07,0x22,0x1A,0xAC,0x21 ,0x20,0x40,0x20,0xF0,0x00,0x00,/*"我",0*/0x00,0x40,0x40,0x20,0xB2,0xA0,0x96,0x90,0x9A,0x4C ,0x92,0x47,0xF6,0x2A,0x9A,0x2A,0x93,0x12,0x91,0x1A,0x99,0x26,0x97,0x22,0x91,0x40 ,0x90,0xC0,0x30,0x40,0x00,0x00,/*"爱",1*/0x00,0x08,0x00,0x08,0xF8,0x0B,0x28,0x09,0x29,0x09 ,0x2E,0x09,0x2A,0x09,0xF8,0xFF,0x28,0x09,0x2C,0x09,0x2B,0x09,0x2A,0x09,0xF8,0x0B ,0x00,0x08,0x00,0x08,0x00,0x00,/*"单",2*/0x00,0x80,0x00,0x40,0x00,0x30,0xFE,0x0F,0x10,0x01 ,0x10,0x01,0x10,0x01,0x10,0x01,0x10,0x01,0x1F,0x01,0x10,0x01,0x10,0xFF,0x10,0x00 ,0x18,0x00,0x10,0x00,0x00,0x00,/*"片",3*/0x08,0x04,0x08,0x03,0xC8,0x00,0xFF,0xFF,0x48,0x00 ,0x88,0x41,0x08,0x30,0x00,0x0C,0xFE,0x03,0x02,0x00,0x02,0x00,0x02,0x00,0xFE,0x3F ,0x00,0x40,0x00,0x78,0x00,0x00, /*机",4*/0x00,0x00,0xFC,0x07,0x44,0x04,0x44,0x04,0x44,0x04 ,0xFC,0x07,0x10,0x00,0x90,0x00,0x10,0x03,0x10,0x40,0x10,0x80,0xFF,0x7F,0x10,0x00 ,0x10,0x00,0x10,0x00,0x00,0x00,/*"时",0*/0x80,0x00,0x40,0x80,0x20,0x40,0x98,0x20,0x87,0x10 ,0x82,0x0F,0x80,0x00,0x80,0x00,0x83,0x20,0x84,0x40,0x98,0x3F,0x30,0x00,0x60,0x00 ,0xC0,0x00,0x40,0x00,0x00,0x00,/*"分",1*/0x12,0x04,0x12,0x03,0xD2,0x00,0xFE,0xFF,0x91,0x00 ,0x11,0x83,0xC0,0x80,0x38,0x40,0x10,0x40,0x00,0x20,0xFF,0x23,0x00,0x10,0x08,0x08 ,0x10,0x04,0x60,0x03,0x00,0x00};/*"秒",2*///------------------------------数字字摸----------------------------------uchar code asc[]={0x00,0x00,0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20 ,0x10,0x10,0xE0,0x0F,0x00,0x00,/*"0",0* /0x00,0x00,0x10,0x20,0x10,0x20,0xF8,0x3F,0x00,0x20 ,0x00,0x20,0x00,0x00,0x00,0x00,/*"1",1* /0x00,0x00,0x70,0x30,0x08,0x28,0x08,0x24,0x08,0x22 ,0x88,0x21,0x70,0x30,0x00,0x00,/*"2",2* /0x00,0x00,0x30,0x18,0x08,0x20,0x88,0x20,0x88,0x20 ,0x48,0x11,0x30,0x0E,0x00,0x00,/*"3",3* /0x00,0x00,0x00,0x07,0xC0,0x04,0x20,0x24,0x10,0x24 ,0xF8,0x3F,0x00,0x24,0x00,0x00,/*"4",4* /0x00,0x00,0xF8,0x19,0x08,0x21,0x88,0x20,0x88,0x20 ,0x08,0x11,0x08,0x0E,0x00,0x00,/*"5",5* /0x00,0x00,0xE0,0x0F,0x10,0x11,0x88,0x20,0x88,0x20 ,0x18,0x11,0x00,0x0E,0x00,0x00,/*"6",6* /0x00,0x00,0x38,0x00,0x08,0x00,0x08,0x3F,0xC8,0x00 ,0x38,0x00,0x08,0x00,0x00,0x00,/*"7",7* /0x00,0x00,0x70,0x1C,0x88,0x22,0x08,0x21,0x08,0x21 ,0x88,0x22,0x70,0x1C,0x00,0x00,/*"8",8*0x00,0x00,0xE0,0x00,0x10,0x31,0x08,0x22,0x08,0x22 ,0x10,0x11,0xE0,0x0F,0x00,0x00,/*"9",9* /0x00,0x00,0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20 ,0x10,0x10,0xE0,0x0F,0x00,0x00};/*"0",1 0*///------------------------------库函数---------------------------void delay(unsigned long v) //延时子函数{while(v--);}void lcd_busy() //繁忙标志{rs=0;rw=1;dataport=0xff;while(1)en=1;if(dataport;=64){set_xy(x-64,y);wdata(dd,0,1);}else{set_xy(x,y);wdata(dd,1,0);}}void set_startline(uchar i)//设定起始行{i=0xc0+i;wcode(i,1,1);}void set_xy(uchar x,uchar y) //定位x,y位置{x=x+0x40;y=y+0xb8;wcode(x,1,1);wcode(y,1,1);}void dison_off(uchar k) //开,关显示{k=k+0x3e;wcode(k,1,1);}void reset(){RST=0;delay(40);RST=1;delay(40);}void lcd_init(void)//芯片初始化{uchar x,y;reset();set_startline(0);dison_off(0);for(y=0;y<8;y++){for(x=0;x<128;x++)lw(x,y,0);}dison_off(1);}void display_hz(uchar xx, uchar yy, uchar n, uchar fb)//显示汉字逐列式{uchar i,dx;for(i=0;i<16;i++){dx=hz[2*i+n*32];if(fb)dx=255-dx;lw(xx*8+i,yy,dx);dx=hz[(2*i+1)+n*32];if(fb)dx=255-dx;lw(xx*8+i,yy+1,dx);}}void display_asc(uchar xx,uchar yy,uchar n,uchar fb)//显示数字逐列式{uchar i,dx;for(i=0;i<8;i++){dx=asc[2*i+n*16];if(fb)dx=255-dx;lw(xx*8+i,yy,dx);dx=asc[2*i+1+n*16];if(fb)dx=255-dx;lw(xx*8+i,yy+1,dx);}}。
12864液晶屏汇编程序
12864液晶屏汇编程序[ 作者:佚名 | 转贴自:本站原创 | 点击数:211 | 更新时间:2005-3-28 | 文章录入:qwll20000 ] XCS BIT 00H ;显示器片选0=CS1,1=CS2 ;20H-2FH为位寻址区,位地址从00H-7FH BZPD BIT 01H ;0=上8X8半字,1=下8X8半字HHBZ BIT 02H ;换行标志HZDH BIT 03H ;0=显示汉字,1=显示动画LCD_RW BIT P3.0LCD_DI BIT P3.1LCD_E BIT P3.3LCD_CS1 BIT P3.5LCD_CS2 BIT P3.4LCD_OPEN DA TA 30HLCD_LINE DATA 31HLCD_PAGE DATA 32HLCD_Y DA TA 33HYCPD DA TA 34H ;左右半屏溢出判断HHPD DA TA 35H ;换行判断XWPD DA TA 36H ;写完一整屏判断ORG 0000HMOV SP,#40HSETB XCS ;选择CS2MOV LCD_OPEN,#01H ;开显示器1,关显示器0LCALL LCDOPENMOV LCD_LINE,#00H ;设置起始行LCALL SETLINEMOV LCD_PAGE,#00H ;设置页地址 LCALL SETPAGEMOV LCD_Y,#00H ;设置列地址 LCALL SETYLJMP CLRST1CLR4:INC LCD_PAGECLRST1:LCALL SETPAGEMOV R7,#40HCLR5:MOV A,#0FFH ;显示校验LCALL LCDWRDATADJNZ R7,CLR5MOV A,LCD_PAGECJNE A,#07H,CLR4MOV LCD_LINE,#00HLCALL SETLINEMOV LCD_PAGE,#00HLCALL SETPAGEMOV LCD_Y,#00HLCALL SETYLJMP CLRST2CLR6:INC LCD_PAGECLRST2:LCALL SETPAGEMOV R7,#40HCLR7:MOV A,#00H ;清显示LCALL LCDWRDATADJNZ R7,CLR7MOV A,LCD_PAGECJNE A,#07H,CLR6CLR XCS ;选择CS1MOV LCD_OPEN,#01H ;开显示器1, 关显示器0 LCALL LCDOPENMOV LCD_LINE,#00HLCALL SETLINE ;设置起始行MOV LCD_PAGE,#00HLCALL SETPAGE ;设置页地址MOV LCD_Y,#00HLCALL SETY ;设置列地址LJMP CLRST3CLR0:INC LCD_PAGECLRST3:LCALL SETPAGEMOV R7,#40HCLR1:MOV A,#0FFH ;显示校验LCALL LCDWRDATADJNZ R7,CLR1MOV A,LCD_PAGECJNE A,#07H,CLR0MOV LCD_LINE,#00HLCALL SETLINEMOV LCD_PAGE,#00HLCALL SETPAGEMOV LCD_Y,#00HLCALL SETYLJMP CLRST4CLR2:INC LCD_PAGECLRST4:LCALL SETPAGEMOV R7,#40HCLR3:MOV A,#00H ;清显示LCALL LCDWRDATADJNZ R7,CLR3MOV A,LCD_PAGECJNE A,#07H,CLR2;初始化完毕************************************************************************* CLR HZDHWRLCD:JNB HZDH,XZFXDH:MOV DPTR,#DHDOT ;写动画或图片LJMP DH0XZF:MOV DPTR,#HZDOT ;写字符(汉字或字母或符号)MOV XWPD,#00HHZ0:CLR XCSMOV LCD_LINE,#00H ;置起始行LCALL SETLINEMOV LCD_PAGE,#00HLCALL SETPAGE ;置页MOV LCD_Y,#00H ;置列LCALL SETYMOV HHPD,#00HHZ7:MOV YCPD,#00HHZ8:CLR BZPDHZ3:MOV R0,#08H ;写左上8个Y列HZ1:MOV A,#00HMOVC A,@A+DPTRLCALL LCDWRDATAINC DPTRINC LCD_YDJNZ R0,HZ1JB BZPD,HZ2CLR C ;Y列减8, 即返回扫描MOV A,LCD_YSUBB A,#08HMOV LCD_Y,ALCALL SETYINC LCD_PAGE ;页地址加1,即换第2页扫描 LCALL SETPAGESETB BZPDLJMP HZ3HZ2:DEC LCD_PAGE ;返回到第1页中,准备下一个半字扫描 LCALL SETPAGEINC YCPDMOV A,YCPDCJNE A,#08H,HZ8JB XCS,HZ9SETB XCS ;换屏LCALL SETPAGEMOV LCD_Y,#00H ;置列LCALL SETYLJMP HZ7HZ9:CLR XCS ;写完一行后从CS2返回到CS1中INC LCD_PAGEINC LCD_PAGELCALL SETPAGE ;下一行开始MOV LCD_Y,#00HLCALL SETYINC HHPDMOV A,HHPDCJNE A,#04H,HZ7INC XWPD ;换第二幅画面MOV A,XWPDCJNE A,#02H,HZ0LJMP$DH0:MOV XWPD,#00HDH1:CLR XCSMOV LCD_LINE,#00H ;置起始行 LCALL SETLINEMOV LCD_PAGE,#00HLCALL SETPAGE ;置页MOV LCD_Y,#00H ;置列LCALL SETYMOV HHPD,#00HDH2:MOV R0,#40H ;写上64个Y列 DH3:MOV A,#00HMOVC A,@A+DPTRLCALL LCDWRDATAINC DPTRDJNZ R0,DH3JB XCS,DH4SETB XCSLCALL SETPAGEMOV LCD_Y,#00HLCALL SETYLJMP DH2DH4:CLR XCS ;写完一行后从CS2返回到CS1中 INC LCD_PAGELCALL SETPAGE ;下一行开始MOV LCD_Y,#00HLCALL SETYINC HHPDMOV A,HHPDCJNE A,#08H,DH2INC XWPD ;换第二幅画面MOV A,XWPDCJNE A,#02H,DH1LJMP$LCDWRINST:NOPJB XCS,INS0CLR LCD_CS1SETB LCD_CS2LJMP INS1INS0:SETB LCD_CS1CLR LCD_CS2INS1:SETB LCD_ECLR LCD_DICLR LCD_RWMOV P1,ALCALL DLY10CLR LCD_ELCALL DLY10RETLCDWRDATA:NOPJB XCS,DA T0CLR LCD_CS1SETB LCD_CS2LJMP DA T1DA T0:SETB LCD_CS1CLR LCD_CS2DA T1:SETB LCD_ESETB LCD_DICLR LCD_RWMOV P1,ALCALL DLY10CLR LCD_ELCALL DLY10NOPRETLCDOPEN:MOV A,LCD_OPEN ;开显示器 ANL A,#3FHORL A,#3EHLCALL LCDWRINSTNOPRETSETLINE:MOV A,LCD_LINEORL A,#0C0H ;设置起始行LCALL LCDWRINSTRETSETPAGE:MOV A,LCD_PAGEANL A,#0BFHORL A,#0B8H ;设置页地址 LCALL LCDWRINSTNOPRETSETY:MOV A,LCD_YANL A,#7FHORL A,#40HNOP ;设置列地址LCALL LCDWRINSTNOPRETDL Y10:NOPMOV R5,#01HDL1:MOV R4,#01HDL2:MOV R6,#0FHDL3:DJNZ R6,DL3DJNZ R4,DL2DJNZ R5,DL1NOPRETHZDOT:;新 CD0C2DB 000H,044H,04CH,07CH,0D7H,0E6H,07CH,05CH DB 000H,022H,01AH,04EH,0FFH,07FH,00EH,09AH DB 044H,0FEH,0FCH,046H,0C2H,0C3H,062H,040H DB 060H,03FH,01FH,000H,0FFH,0FFH,000H,000H;年 CC4EADB 000H,020H,010H,018H,0ECH,0CFH,04AH,048H DB 000H,004H,004H,004H,007H,007H,004H,004H DB 0F8H,0F8H,048H,048H,068H,04CH,008H,000H DB 0FFH,0FFH,004H,004H,004H,004H,006H,004H;快 CBFECDB 000H,0C0H,060H,0FFH,0FEH,030H,060H,008H DB 000H,000H,000H,0FFH,07FH,080H,041H,071H DB 008H,0FFH,0FEH,008H,0F8H,0FCH,008H,000H DB 03DH,00FH,007H,00DH,039H,071H,0E1H,041H;乐 CC0D6DB 000H,000H,080H,080H,0FEH,0FCH,084H,084H DB 000H,040H,020H,030H,01CH,00EH,024H,040H DB 0FEH,0F6H,082H,083H,0C2H,080H,000H,000H DB 0FFH,07FH,000H,002H,00CH,018H,070H,020H;欢 CBBB6DB 000H,034H,0C4H,004H,0C4H,0FCH,03EH,024H DB 000H,040H,038H,00FH,007H,03CH,098H,060H DB 018H,00EH,0EFH,0CAH,048H,038H,01CH,008H DB 030H,01CH,00FH,007H,01CH,070H,0E0H,040H;迎 CD3ADDB 000H,040H,046H,0DCH,0E8H,040H,0FEH,0FCH DB 000H,040H,0E0H,03FH,01FH,032H,067H,0C3H DB 006H,003H,0FDH,0FCH,004H,0FCH,0FEH,004H DB 0C2H,0C1H,0FFH,0DFH,0C2H,0C7H,0C3H,040H;使 CCAB9DB 000H,080H,060H,0F8H,0EFH,006H,008H,0F8H DB 000H,000H,000H,0FFH,07FH,080H,080H,043H DB 0E8H,028H,0FFH,0FEH,028H,0E8H,0FCH,028H DB 065H,039H,01FH,037H,061H,063H,0C1H,040H;用 CD3C3DB 000H,000H,000H,0FFH,0FEH,022H,022H,022H DB 000H,080H,070H,03FH,00FH,002H,002H,002H DB 0FEH,0FEH,022H,022H,022H,0FEH,0FFH,002H DB 07FH,03FH,002H,042H,042H,0FFH,07FH,000H;杭 CBABCDB 000H,010H,0D0H,0FFH,0FEH,090H,010H,008H DB 000H,006H,001H,0FFH,07FH,001H,083H,040H DB 0E8H,0C9H,04FH,04EH,0C8H,0E8H,04CH,008H DB 07FH,03FH,000H,000H,07FH,0FFH,0C0H,070H;州 CD6DDDB 000H,010H,0E0H,0C0H,0FFH,0FEH,010H,0E0H DB 000H,080H,041H,070H,03FH,00FH,000H,001H DB 0C0H,0FEH,0FCH,030H,0E0H,0C0H,0FFH,0FEH DB 000H,03FH,01FH,000H,001H,000H,0FFH,07FH;求 CC7F3DB 000H,000H,008H,068H,0C8H,088H,008H,0FFH DB 000H,010H,070H,038H,00DH,026H,041H,0FFH DB 0FEH,088H,0CBH,07EH,02CH,008H,000H,000H DB 07FH,003H,006H,01CH,038H,070H,020H,000H;是 CCAC7DB 000H,080H,080H,080H,0FFH,0BEH,0AAH,0AAH DB 000H,080H,060H,038H,00FH,01AH,030H,020H DB 0AAH,0AAH,0AAH,0FEH,0BFH,082H,0C0H,080H DB 07FH,07FH,044H,0C4H,0C6H,0C4H,0C0H,040H;医 CD2BDDB 000H,000H,0FFH,0FEH,042H,0A2H,0BAH,09EH DB 000H,040H,0FFH,07FH,060H,050H,058H,04CH DB 096H,0F2H,0F2H,092H,09AH,0D3H,082H,000H DB 046H,043H,041H,046H,04CH,058H,068H,040H;学 CD1A7DB 000H,010H,038H,01CH,00BH,04EH,048H,04BH DB 000H,000H,004H,004H,004H,004H,044H,044HDB 04EH,0C8H,0ECH,04FH,00AH,038H,01CH,008H DB 0FFH,07FH,004H,004H,004H,006H,004H,000H;科 CBFC6DB 000H,024H,0A4H,0FEH,0FEH,0A3H,022H,0C0H DB 000H,00CH,003H,0FFH,07FH,001H,00BH,008H DB 08CH,038H,010H,0FFH,0FEH,000H,000H,000HDB 00BH,005H,004H,0FFH,07FH,002H,003H,002H;技 CBCBCDB 000H,010H,010H,0FFH,0FEH,010H,098H,048H DB 000H,00CH,046H,0FFH,07FH,001H,080H,040H DB 0C8H,048H,07FH,07EH,0C8H,0E8H,04CH,008H DB 061H,037H,01CH,01EH,037H,061H,0E0H,040H;有 CD3D0DB 000H,084H,044H,064H,034H,0FCH,0EFH,026H DB 000H,000H,000H,000H,000H,0FFH,07FH,009H DB 024H,024H,024H,0E4H,0F4H,024H,006H,004H DB 009H,009H,049H,0FFH,07FH,000H,000H,000H;限 CCFDEDB 000H,0FFH,0FEH,042H,0BEH,01FH,002H,0FFH DB 000H,0FFH,0FFH,008H,01FH,00FH,040H,0FFH DB 0FEH,092H,092H,092H,0FEH,0FFH,002H,000H DB 07FH,061H,036H,01CH,039H,06EH,0E4H,040H;公 CB9ABDB 000H,000H,080H,0C0H,070H,03EH,00FH,082H DB 000H,001H,000H,060H,0F0H,078H,06EH,067H DB 0C0H,080H,00FH,03EH,070H,0E0H,0C0H,080H DB 021H,022H,026H,03CH,0F8H,070H,001H,000H;司 CCBBEDB 000H,000H,010H,0D2H,092H,092H,092H,092H DB 000H,000H,000H,01FH,00FH,008H,008H,008HDB 01FH,00FH,000H,040H,040H,0FFH,07FH,000H;地 CB5D8DB 000H,020H,020H,0FEH,0FCH,020H,060H,0F8H DB 000H,010H,030H,01FH,01FH,008H,004H,07FH DB 0F0H,020H,0FFH,0FEH,010H,0F0H,0F8H,010H DB 0FFH,0C0H,0C7H,0C7H,0C2H,0C7H,0F3H,040H;址 CD6B7DB 000H,020H,020H,0FEH,0FCH,020H,020H,0E0H DB 000H,010H,030H,03FH,01FH,058H,048H,07FH DB 0C0H,000H,000H,0FFH,0FEH,040H,060H,040H DB 07FH,040H,040H,07FH,07FH,040H,060H,040H;: CA3BADB 000H,000H,000H,000H,000H,000H,000H,000H DB 000H,000H,036H,036H,000H,000H,000H,000H DB 000H,000H,000H,000H,000H,000H,000H,000H DB 000H,000H,000H,000H,000H,000H,000H,000H;通 CCDA8DB 000H,040H,046H,0DCH,0E8H,040H,000H,0F9H DB 000H,040H,0E0H,03FH,01FH,030H,060H,0FFH DB 0F1H,055H,0FDH,0F9H,057H,0F3H,0F9H,010H DB 0DFH,0C2H,0DFH,0CFH,0D2H,0FFH,0DFH,040H;惠 CBBDDDB 000H,000H,002H,0FEH,0FAH,0AAH,0AAH,0FFHDB 0FFH,0AAH,0AAH,0FAH,0FEH,00AH,000H,000H DB 0FBH,0D2H,0C2H,0F2H,04FH,016H,070H,020H;北 CB1B1DB 000H,020H,020H,020H,020H,0FEH,0FEH,000H DB 000H,020H,060H,020H,010H,0FFH,0FFH,000H DB 000H,0FFH,0FEH,082H,0C0H,060H,038H,010H DB 000H,07FH,0FFH,0C1H,0C0H,0C0H,0F0H,040H;路 CC2B7DB 000H,07FH,03EH,0E2H,0BEH,07FH,002H,010H DB 000H,07CH,060H,03FH,03FH,012H,00BH,001H DB 08CH,0DFH,066H,074H,0DCH,08EH,004H,000H DB 0FFH,07EH,042H,042H,0FEH,07FH,003H,001H;2 CHAR_32DB 008H,00CH,084H,0C4H,064H,03CH,018H,000H DB 00EH,00FH,009H,008H,008H,00CH,00CH,000H;8 CHAR_38DB 0B8H,0FCH,044H,044H,044H,0FCH,0B8H,000H DB 007H,00FH,008H,008H,008H,00FH,007H,000H;号 CBAC5DB 000H,080H,080H,080H,0BFH,09EH,092H,092H DB 000H,000H,000H,000H,004H,00EH,007H,005H DB 092H,092H,092H,0BEH,09FH,082H,0C0H,080H DB 024H,044H,0E4H,07CH,01EH,004H,000H,000H;电 CB5E7DB 000H,000H,0F8H,0F0H,090H,090H,090H,0FFH DB 000H,000H,00FH,007H,004H,004H,004H,07FH DB 0FEH,090H,090H,090H,0F0H,0F8H,010H,000H DB 0FFH,0C4H,0C4H,0C4H,0CFH,0C7H,0F0H,040H;话 CBBB0DB 000H,040H,046H,0DCH,0E8H,040H,020H,024H DB 000H,000H,020H,07FH,03FH,010H,008H,0FFH DB 024H,024H,0FEH,0FEH,026H,023H,032H,020H DB 07EH,042H,043H,043H,042H,0FEH,07FH,002H;: CA3BADB 000H,000H,000H,000H,000H,000H,000H,000H DB 000H,000H,036H,036H,000H,000H,000H,000H DB 000H,000H,000H,000H,000H,000H,000H,000H DB 000H,000H,000H,000H,000H,000H,000H,000H;0 CHAR_30DB 0F8H,0FCH,004H,0C4H,024H,0FCH,0F8H,000H DB 007H,00FH,009H,008H,008H,00FH,007H,000H;5 CHAR_35DB 07CH,07CH,044H,044H,0C4H,0C4H,084H,000H DB 004H,00CH,008H,008H,008H,00FH,007H,000H;7 CHAR_37DB 00CH,00CH,004H,084H,0C4H,07CH,03CH,000HDB 000H,000H,00FH,00FH,000H,000H,000H,000H;1 CHAR_31DB 000H,010H,018H,0FCH,0FCH,000H,000H,000H DB 000H,008H,008H,00FH,00FH,008H,008H,000H;- CHAR_2DDB 080H,080H,080H,080H,080H,080H,080H,000H DB 000H,000H,000H,000H,000H,000H,000H,000H;8 CHAR_38DB 0B8H,0FCH,044H,044H,044H,0FCH,0B8H,000H DB 007H,00FH,008H,008H,008H,00FH,007H,000H;2 CHAR_32DB 008H,00CH,084H,0C4H,064H,03CH,018H,000H DB 00EH,00FH,009H,008H,008H,00CH,00CH,000H;6 CHAR_36DB 0F0H,0F8H,04CH,044H,044H,0C0H,080H,000H DB 007H,00FH,008H,008H,008H,00FH,007H,000H;0 CHAR_30DB 0F8H,0FCH,004H,0C4H,024H,0FCH,0F8H,000H DB 007H,00FH,009H,008H,008H,00FH,007H,000H;4 CHAR_34DB 0C0H,0E0H,0B0H,098H,0FCH,0FCH,080H,000H DB 000H,000H,000H,008H,00FH,00FH,008H,000H;7 CHAR_37DB 00CH,00CH,004H,084H,0C4H,07CH,03CH,000HDB 000H,000H,00FH,00FH,000H,000H,000H,000H;1 CHAR_31DB 000H,010H,018H,0FCH,0FCH,000H,000H,000HDB 000H,008H,008H,00FH,00FH,008H,008H,000H;5 CHAR_35DB 07CH,07CH,044H,044H,0C4H,0C4H,084H,000HDB 004H,00CH,008H,008H,008H,00FH,007H,000HDHDOT:;-------------------------------------------------------------------------------DB000H,000H,000H,000H,000H,000H,000H,000H,007H,0E7H,0E3H,0E1H,0E1H,0E1H,0E1H,0C1H, DB0C1H,081H,081H,081H,083H,083H,083H,083H,087H,087H,08FH,08FH,09FH,0BFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0F3H,0F3H,0F1H,0E1H,061H,061H,020H, DB030H,030H,0B0H,0B0H,0B0H,0B8H,0B8H,0BCH,0BCH,03EH,03EH,03FH,03FH,07FH,07FH,07FH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FEH,0FEH,0FCH,0FCH,0FCH,0FEH,0FFH, DB0F7H,0E3H,0E7H,0EFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,000H,000H,000H, DB000H,000H,000H,000H,000H,000H,000H,000H,000H,001H,07FH,0FFH,0F3H,083H,083H,081H,DB001H,001H,000H,080H,080H,000H,002H,002H,002H,006H,004H,0A5H,0EDH,0EDH,0EBH,0DBH, DB0F7H,0BFH,07FH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0F7H,089H,080H,082H,0C0H,080H, DB000H,000H,000H,000H,000H,088H,0C0H,0F8H,0F8H,0F8H,0F0H,0F0H,0E0H,0C0H,0C0H,0F0H, DB0F8H,0F8H,0FCH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,00FH,000H,000H,000H, DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,07FH,0FFH,0FFH,0FFH,0FFH,DB0FFH,0FEH,0FFH,0FFH,0FFH,0FFH,0FEH,0FEH,0FEH,0FEH,0FEH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,03FH,00FH,003H,000H,000H,000H,000H,000H, DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,03FH,03FH,07FH,0BFH,03FH,03FH, DB03FH,01FH,01FH,00FH,007H,007H,001H,000H,000H,000H,000H,000H,000H,000H,000H,000H, DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,003H,03FH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,01FH,000H,000H,07CH,0FFH,0FFH,078H, DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,003H,0FFH,DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0E3H,0E3H,0C3H,087H,08FH,01FH,01FH,0BFH,0BFH,0FFH,0FFH, DB0FFH,0F7H,0F3H,0F3H,0FBH,0FBH,0FBH,0FBH,0FBH,0FBH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,07FH,07FH,07FH,07FH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,00FH,000H,000H,000H,000H,000H,000H,000H, DB000H,000H,000H,000H,000H,000H,0E0H,0F8H,0FCH,0FEH,0FEH,0FEH,0FEH,0FEH,0FCH,0FCH, DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,0F8H,0FFH,DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,DB0FFH,0FDH,0F9H,0F3H,0E7H,0C7H,087H,007H,007H,0C7H,087H,087H,08FH,08FH,08FH,0CFH, DB0CFH,0DFH,0FFH,09FH,0DFH,0DFH,0FFH,0CFH,0EFH,0EFH,0FFH,0FFH,0CFH,0CFH,0E7H,0E7H, DB0E3H,0E3H,0E3H,0F1H,0F9H,0F9H,0F8H,0FCH,0FCH,0FEH,0FEH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,03FH,00FH,007H,000H,000H,000H,000H,000H,000H,000H,000H,000H,DB000H,000H,000H,000H,000H,000H,000H,007H,027H,07FH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,0E0H,0FCH,0FFH,0FFH,DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0F8H,0F1H,0F3H,0E7H,0CFH,0CFH,0DFH,0DFH, DB09FH,09FH,0BFH,0BFH,0BFH,09FH,0DFH,0DFH,0DFH,0CFH,0EFH,0FFH,0FFH,0FFH,0FBH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0F7H,0FDH,0FCH,0FCH,0FEH,0FFH,0FCH,0C0H,000H,000H,000H,000H,000H,000H,000H, DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,001H,0F1H,0FFH,0FFH,。
12864液晶电子时钟+温度显示
12864液晶电子时钟+温度显示上午花了一上午时间,用12864 液晶写了一个电子时钟加温度传感器程序,先说一下程序的功能,可以实现显示年月日时间和温度,年月日和时间是可通过按键调节的,调节相应的选项时,该选项会闪烁,并停止走时,当调节完毕后时钟恢复走时。
现在将程序和思路写下来,以便日后查看和与大家探讨改进,欢迎高手提出宝贵意见。
我使用的是HJ12864M-1 带字库液晶,所以在显示上稍微方便一点。
下面先来说一下我的编程思路。
时间更新用的是单片机自带的定时器,液晶要显示数字必需将它转换成ASCii 码的形式,数字0-9 的ASCii 码与数字之间有一个定量的关系,当数字加上0x30 之后便得到该数字的ASCii 码,这样以来液晶更新数据就变得简单了。
调节时间时对应选项闪烁,是通过不断的交替写入数据和空格实现的。
温度显示用的是DS18B20,,将测得的当前温度不断更新显示在液晶上。
调节时间用的是三个独立按键。
由于这个程序我使用模块化来写的,就只能将每个模块分别给出来,大家只要组装一下便可以使用。
如果需要完整程序的可以给我留言我发给你们。
下面是12864 液晶的初始化,读写命令,及读忙操作#include “lcd12864.h”#include reg52.hsbit RS=P2 ; //控制端口位定义sbitRW=P2;s b it EN=P2;vo id init_12864(){delay(40);write_com(0x30);//8 位数据格式,基本指令显示delay(10); //延时时间write_com(0x30);//8 位数据格式,基本指令显示delay(37);write_com(0x0C);//开显示、关闭光标delay(10);write_com(0x01);//清屏指令delay(10); //延时write_com(0x06);//设置显示点:指针自加1}tips:感谢大家的阅读,本文由我司收集整编。
基于单片机的12864液晶显示时钟汇编程序
;**********此程序用于12864(lgm12641bs1r)液晶显示汉字(没有字库)********* ;****************2011.3.30**************lcm equ p1cs1 bit p2.4 ;cs1片选左屏cs2 bit p2.3 ;cs2片选右屏di bit p2.2rw bit p2.1e bit p2.0rst bit p2.7x equ 30hy equ 31hdd equ 32hxx equ 33hyy equ 34hhz equ 35horg 0000hljmp mainorg 0030hmain: ;lcall lcd_init;mov r5,#0ffh;lcall delaymov xx,#00hmov yy,#00h;mov hz,hz1mov dptr,#tab1lcall disp_hz;lcall delaymov xx,#0hmov yy,#02hmov dptr,#tab2lcall disp_hzmov xx,#1hmov yy,#00hmov dptr,#tab1lcall disp_hzljmp $;************设定起始行子程序********************set_startline:;此处由a值进入add a,#0c0hsetb cs1setb cs2lCALL w_coderet;******************写指令到lcm中******************w_code: ;调用此子程序之前须设定片选,数据由a进入lcall lcd_busyclr di ;低电平选中指令输入端clr rw;lcall lcd_busymov lcm,asetb eclr eret;******************写数据到lcm中******************w_data: ;调用此子程序之前须设定片选,数据由a进入lcall lcd_busysetb di;高电平选中数据输入端clr rwmov lcm,asetb eclr eret;**************设定x,y坐标,数据并由x,y传入*****set_xy:mov a,xadd a,#40hsetb cs1setb cs2lcall w_codemov a,yadd a,#0b8hsetb cs1setb cs2lcall w_coderet;***********开关屏数据由a传入,0为关,1为开*************** dison_off:add a,#3ehsetb cs1setb cs2lcall w_coderet;************复位程序************************************** reset: clr rstmov r5,#20 ;延时20mslcall delaysetb rstmov r5,#20lcall delayret;************初始化lcd**********************************lcd_init:lcall resetmov a,#00hlcall dison_off ;关显示mov y,#00hxx2: mov x,#0mov dd,#00hxx1: lcall lwinc xmov a,xcjne a,#128,xx1inc ymov a,ycjne a,#8,xx2;djnz x,xx1;djnz y,xx2mov a,#01hlcall dison_off ;开显示mov a,#00h ; 起始行为0lcall set_startlineret;************写数据到lcm指定位置**********************;************此子程序由x,y,dd导入数据***************lw: mov a,xcjne a,#64,x1x1: jc x2;mov a,xclr csubb a,#64mov x,alcall set_xyclr cs1setb cs2mov a,ddlcall w_dataljmp fanhuix2: lcall set_xysetb cs1clr cs2mov a,ddlcall w_datafanhui: ret;***************显示一个汉字子程序*****************;**********此程序由xx(表示该行第xx个字),yy(表示第yy行),hz(要写入的汉字)导入数据**********disp_hz:;mov dptr,#tab1mov r7,#0 ;ixx0:mov a,r7mov b,#2mul abinc amov 7fh,adec amovc a,@a+dptrmov dd,amov a,xxmov b,#16mul abadd a,r7mov x,amov y,yylcall lwmov a,7fhmovc a,@a+dptrmov dd,ainc ylcall lwinc r7cjne r7,#16,xx0retdelay: ;1msd3: mov r3,#090hd1: mov r4,#2hd2: djnz r4,d2djnz r3,d1djnz r5,d3retlcd_busy: ;判忙clr disetb rwrettab3: DB 80h,80h,40h,20h,50h,48h,44h,0C3h,44h,48h,50h,20h,40h,80h,80h,00h DB 40h,40h,42h,4Ah,72h,42h,42h,7Fh,42h,42h,62h,5Ah,42h,40h,40h,00htab1:db 40h,40h,40h,40h,20h,42h,20h,42h,50h,4Ah,48h,72h,44h,42h,0C3h,7Fh,db 44h,42h,48h,62h,50h,5Ah,50h,42h,20h,42h,60h,40h,20h,40h,00h,00htab2:DB 00h,80h,60h,0F8h,07h,00h,0FCh,44h,44h,44h,44h,44h,44h,0FCh,00h,00hDB 01h,00h,00h,0FFh,00h,40h,4Fh,44h,44h,44h,44h,44h,44h,4Fh,40h,00h end。
多种12864液晶屏显示程序
多种12864液晶屏显示程序(1)#include#define uchar unsigned char#define uint unsigned int#define lcddata P0sbit RS=P2^0;sbit RW=P2^1;sbit E=P2^2;sbit PSB=P2^3;void delayms(uint n)//1T单片机毫秒延时函数{ unsigned int x;while(n--){x=627;while(x--);}}void delayus(uint t)//1T单片机微秒延时函数{ unsigned int a,b;for(b=t;b>0;b--)for(a=3;a>0;a--);}bit lcdbusy() //忙检查{bit result;RS=0;RW=1;E=1;delayus(5);result=(bit)(P0&0x80);E=0;return(result) ;}void writecmd(uchar cmd) //写命令{while(lcdbusy()) ;RS=0;RW=0;E=0;delayus(5);P0=cmd;delayus(10);E=1;delayus(5);E=0;}void writedat(uchar dat) //写数据{while(lcdbusy()) ;RS=1;RW=0;E=0;delayus(5);P0=dat;delayus(10);E=1;delayus(5);E=0;}void print(uchar place,uchar num,uchar *point)//液晶屏显示数组{uchar i,progdata;writecmd(place);for(i=0;i<="">{progdata=*(point+i);writedat(progdata);}}void lcdclear(){unsigned char i;writecmd(0x30);writecmd(0x80);writecmd(0x01);delayus(20);for(i=0;i<64;i++)writedat(' ');}void lcdinit()//液晶屏初始化{PSB=1;//并口方式writecmd(0x30);//基本指令操作delayms(5);writecmd(0x06);//写一个字符后地址指针自动加1 delayms(5);writecmd(0x0c);//开显示,关光标delayms(5);writecmd(0x01);//清屏指令delayms(5);}void main(){lcdinit();print(0x80,3,"战斗机");//起始位,显示汉字数print(0x85,3,"巡洋舰");print(0x8a,4,"航空母舰");while(1);}(2)#include#define uchar unsigned char#define uint unsigned int#define lcddata P0sbit RS=P2^0;sbit RW=P2^1;sbit E=P2^2;sbit PSB=P2^3;void delayms(uint n)//1T单片机毫秒延时函数{ unsigned int x;while(n--){x=627;while(x--);}}void delayus(uint t)//1T单片机微秒延时函数{ unsigned int a,b;for(b=t;b>0;b--)for(a=3;a>0;a--);}bit lcdbusy() //忙检查{bit result;RS=0;RW=1;E=1;delayus(5);result=(bit)(P0&0x80);E=0;return(result) ;}void writecmd(uchar cmd) //写命令{while(lcdbusy()) ;RS=0;RW=0;E=0;delayus(5);P0=cmd;delayus(10);E=1;delayus(5);E=0;}void writedat(uchar dat) //写数据{while(lcdbusy()) ;RS=1;RW=0;E=0;delayus(5);P0=dat;delayus(10);E=1;delayus(5);E=0;}void lcdpos(uchar x,uchar y)//液晶屏显示位置,x轴0~7,y轴0~7 {uchar pos;if(x==0){x=0x80;}else if(x==1){x=0x90;}else if(x==2){x=0x88;}else if(x==3){x=0x98;}pos=x+y;writecmd(pos);}void print(uchar *str) //液晶屏显示数组{while(*str!='\0'){writedat(*str);str++;}}void lcdclear()//液晶屏清屏函数{unsigned char i;writecmd(0x30);writecmd(0x80);writecmd(0x01);delayus(20);for(i=0;i<64;i++)writedat(' ');}void lcdinit()//液晶屏初始化{PSB=1;//并口方式writecmd(0x30);//基本指令操作delayms(5);writecmd(0x06);//写一个字符后地址指针自动加1 delayms(5); writecmd(0x0c);//开显示,关光标delayms(5);writecmd(0x01);//清屏指令delayms(5);}void main(){lcdinit();lcdpos(0,0);//起始位(行数,列数)print("战斗机");lcdpos(0,5);print("巡洋舰");lcdpos(2,2);print("航空母舰");while(1);}(3)#include#define uchar unsigned char#define uint unsigned int#define lcddata P0sbit RS=P2^0;sbit RW=P2^1;sbit E=P2^2;sbit PSB=P2^3;uchar code dis1[]="战斗机"; //液晶屏一行显示8个汉字,16个字节(i=0;i<16;i++)uchar code dis2[]="巡洋舰";uchar code dis3[]="航空母舰";void delayms(uint n)//1T单片机毫秒延时函数{unsigned int x;while(n--){x=627;while(x--);}}void delayus(uint t)//1T单片机微秒延时函数{unsigned int a,b;for(b=t;b>0;b--)for(a=3;a>0;a--);}bit lcdbusy() //忙检查{bit result;RW=1;E=1;delayus(5);result=(bit)(P0&0x80);E=0;return(result) ;}void writecmd(uchar cmd) //写命令{while(lcdbusy()) ;RS=0;RW=0;E=0;delayus(5);P0=cmd;delayus(10);E=1;delayus(5);E=0;}void writedat(uchar dat) //写数据{while(lcdbusy()) ;RS=1;RW=0;E=0;delayus(5);P0=dat;delayus(10);delayus(5);E=0;}void lcdpos(uchar x,uchar y)//液晶屏显示位置,x轴0~7,y轴0~7 {uchar pos;if(x==0){x=0x80;}else if(x==1){x=0x90;}else if(x==2){x=0x88;}else if(x==3){x=0x98;}pos=x+y;writecmd(pos);}void lcdclear()//液晶屏清屏函数{unsigned char i;writecmd(0x30);writecmd(0x80);writecmd(0x01);delayus(20);for(i=0;i<64;i++)writedat(' ');}void lcdinit()//液晶屏初始化{PSB=1;//并口方式writecmd(0x30);//基本指令操作delayms(5);writecmd(0x06);//写一个字符后地址指针自动加1delayms(5);writecmd(0x0c);//开显示,关光标delayms(5);writecmd(0x01);//清屏指令delayms(5);}void main(){uint i;lcdinit();lcdpos(0,0);//起始位(行数,列数)for(i=0;i<6;i++)//占用字节数(一个汉字占两个字节,一个字母、数字、符号占一个字节)writedat(dis1[i]);lcdpos(0,5);for(i=0;i<6;i++)writedat(dis2[i]);lcdpos(2,2);for(i=0;i<8;i++)writedat(dis3[i]);while(1);}(4)#include#define uchar unsigned char#define uint unsigned int#define lcddata P0sbit RS=P2^0;sbit RW=P2^1;sbit E=P2^2;sbit PSB=P2^3;uchar code dis1[]="战斗机"; //液晶屏一行显示8个汉字,16个字节(i=0;i<16;i++)uchar code dis2[]="巡洋舰";uchar code dis3[]="航空母舰";void delayms(uint n)//1T单片机毫秒延时函数{unsigned int x;while(n--){x=627;while(x--);}}void delayus(uint t)//1T单片机微秒延时函数{unsigned int a,b;for(b=t;b>0;b--)for(a=3;a>0;a--);}bit lcdbusy() //忙检查{bit result;RS=0;RW=1;E=1;delayus(5);result=(bit)(P0&0x80);E=0;return(result) ;}void writecmd(uchar cmd) //写命令{while(lcdbusy()) ;RS=0;RW=0;E=0;delayus(5);P0=cmd;delayus(10);E=1;delayus(5);E=0;}void writedat(uchar dat) //写数据{while(lcdbusy()) ;RS=1;RW=0;E=0;delayus(5);P0=dat;delayus(10);E=1;delayus(5);E=0;}void lcdpos(uchar x,uchar y)//液晶屏显示位置,x轴0~7,y轴0~7 {uchar pos;if(x==0){x=0x80;}else if(x==1){x=0x90;}else if(x==2){x=0x88;}else if(x==3){x=0x98;}pos=x+y;writecmd(pos);}void lcdclear()//液晶屏清屏函数{unsigned char i;writecmd(0x30);writecmd(0x80);writecmd(0x01);delayus(20);for(i=0;i<64;i++)writedat(' ');}void lcdinit()//液晶屏初始化{PSB=1;//并口方式writecmd(0x30);//基本指令操作delayms(5);writecmd(0x06);//写一个字符后地址指针自动加1 delayms(5); writecmd(0x0c);//开显示,关光标delayms(5);writecmd(0x01);//清屏指令delayms(5);}void main(){uint i;lcdinit();lcdpos(0,0);//起始位(行数,列数)i=0;while(dis1[i]!='\0'){writedat(dis1[i]);//显示字符i++;}lcdpos(0,5);i=0;while(dis2[i]!='\0'){writedat(dis2[i]);i++;}lcdpos(2,2);i=0;while(dis3[i]!='\0'){writedat(dis3[i]);i++;}while(1); }(5)#include#define uchar unsigned char#define uint unsigned intsbit CS=P2^0; //片选信号sbit SID=P2^1; //数据信号sbit SCLK=P2^2; //时钟信号sbit PSB=P2^3; //串并行选择,H并行,L串行sbit key=P3^0;unsigned char code temp1[]={"战斗机"}; unsigned char code temp2[]={"航空母舰"};void delayms(uint n)//毫秒延时{unsigned int x;while(n--){x=627;while(x--);}}void delay(uint m)//100us延时{unsigned int da,db;for(da=0;da<m;da++)< bdsfid="537" p=""></m;da++)<> for(db=0;db<100;db++);}void sendbyte(uchar bbyte) //发送一个字节{unsigned char i;for(i=0;i<8;i++){SID=bbyte&0x80;SCLK=1;SCLK=0;bbyte<<=1;}}void writechar(bit start,uchar ddata) //写指令或数据{unsigned char start_data,Hdata,Ldata;if(start==0)start_data=0xf8;elsestart_data=0xfa;Hdata=ddata&0xf0;Ldata=(ddata<<4)&0xf0;sendbyte(start_data);delay(5);sendbyte(Hdata);delay(1);sendbyte(Ldata);delay(1);}void lcdsetxy(uchar x,uchar y)//设置LCD显示的起始位置,X 为行,Y为列{uchar address;switch(x){case 0: address = 0x80 + y; break;case 1: address = 0x80 + y; break;case 2: address = 0x90 + y; break;case 3: address = 0x88 + y; break;case 4: address = 0x98 + y; break;default:address = 0x80 + y; break;}writechar(0, address);}void print(uchar X,uchar Y,uchar *s)//中英文字符串显示函数{lcdsetxy( X, Y );while (*s){writechar( 1, *s );s ++;delay(1);}}void lcdclear() //清屏函数{writechar(0,0x01);}void lcdinit(){delay(10);PSB=0;CS=1;writechar(0,0x30); writechar(0,0x0c); writechar(0,0x01); } void main(){lcdinit();print(1,2,temp1);print(3,2,temp2);while(1);}。
12864液晶屏使用手册
12864液晶屏手册一、液晶显示模块概述12864A-1汉字图形点阵液晶显示模块,可显示汉字及图形,内置8192个中文汉字(16X16点阵,16*8=128,16*4=64,一行只能写8个汉字,4行;)、128个字符(8X16点阵)及64X256点阵显示RAM(GDRAM)。
主要技术参数和显示特性:电源:VDD ~+5V(内置升压电路,无需负压);显示内容:128列× 64行(128表示点数)显示颜色:黄绿显示角度:6:00钟直视LCD类型:STN与MCU接口:8位或4位并行/3位串行配置LED背光多种软件功能:光标显示、画面移位、自定义字符、睡眠模式等二、外形尺寸1.外形尺寸图2.主要外形尺寸项目标准尺寸单位模块体积××mm二、模块引脚说明逻辑工作电压(VDD):~电源地(GND):0V工作温度(Ta):0~60℃(常温) / -20~75℃(宽温)三、接口时序模块有并行和串行两种连接方法(时序如下):8位并行连接时序图MPU写资料到模块MPU从模块读出资料2、串行连接时序图串行数据传送共分三个字节完成:第一字节:串口控制—格式 11111ABCA为数据传送方向控制:H表示数据从LCD到MCU,L表示数据从MCU到LCD B为数据类型选择:H表示数据是显示数据,L表示数据是控制指令C固定为0第二字节:(并行)8位数据的高4位—格式 DDDD0000第三字节:(并行)8位数据的低4位—格式 0000DDDD串行接口时序参数:(测试条件:T=25℃ VDD=四、用户指令集备注:1、当模块在接受指令前,微处理顺必须先确认模块内部处于非忙碌状态,即读取BF标志时BF需为0,方可接受新的指令;如果在送出一个指令前并不检查BF标志,(一般在输入每天指令前加个delay)那么在前一个指令和这个指令中间必须延迟一段较长的时间,即是等待前一个指令确实执行完成,指令执行的时间请参考指令表中的个别指令说明。
12864液晶屏显示温度日期时间程序
sbit key3=P3^6;
sbit beep=P0^5;
//------------------------------------------------------------------
// ds1302定义
//-----------------------------------------------------------------
unsigned char dat1 = 0;
for (i=8;i>0;i--)
{
DQ = 0; // 给脉冲信号
dat1>>=1;
DQ = 1; // 给脉冲信号
if(DQ)
dat1|=0x80;
delay(5);
}
return(dat1);
//set time--second,munite,hour,day,month,week,year
//-----------------------------------------------------------------
//*****************************************************************
//往DS31302中写入一字节
//*****************************************************************
void writebyte_ds1302(uchar ds1302_data)
{
uchar i;
uchar temp_data=ds1302_data;
12864显示时间代码
#include <reg52.h>#include <intrins.h>#include "delay.h"sbit rs = P2^4; //寄存器选择输入sbit rw = P2^5; //液晶读/写控制sbit en = P2^6; //液晶使能控制sbit psb = P2^1; //串/并方式控制uchar table[]="电子时钟";uchar table[]="日期:2014-7-16";uchar table[]="时间:23:23:53";uchar table[]="闹钟:00:00:00";void write_12864com(uchar com); //定义写指令到12864 void write_12864dat(uchar dat); //定义写数据到12864 void init(void); //函数初始化定义void display1(void); //声明一个显示函数void display2(void);void display3(void);void main() //主函数{init();while(1){//display1();//display2();display3();while(1);}}void write_12864com(uchar com) //写指令到12864{rw=0; //低电平写rs=0; //写指令delay_50us(1);P0=com;en=1; //使能信号高电平delay_50us(10);en=0; //使能信号低电平delay_50us(2);}void write_12864dat(uchar dat) //写数据到12864{rw=0; //低电平写rs=1; //写数据delay_50us(1);P0=dat;en=1; //使能信号高电平delay_50us(10);en=0; //使能信号低电平delay_50us(2);}void init(void) //函数初始化{delay_50ms(2); //延时40mswrite_12864com(0x30); //基本指令设置delay_50us(4); //延时100uswrite_12864com(0x30); //功能设置delay_50us(4); //延时100uswrite_12864com(0x0f); //控制D=1整体显示开C=1游标开B=1游标位置反白允许delay_50us(4); //延时100uswrite_12864com(0x01); //屏幕清零delay_50us(240);write_12864com(0x06);delay_50us(10);}void display1(void){uchar i;uchar a;a=0x00;write_12864com(0x80); //设置地址delay_50us(1);for(i=0;i<16;i++){write_12864dat(a);delay_50us(1);a++;}}void display2(void){uchar i;uchar a,b;a=0xBA;b=0xC0;write_12864com(0x80);for(i=0;i<8;i++){write_12864dat(a);write_12864dat(b);delay_50us(1);b++;}}void display3(void){uchar i;write_12864com(0x80);for(i=0;i<16;i++){write_12864dat(table[i]);delay_50us(1);}}。
12864LCD显示倒计时程序
简介:第一行显示,距离系统爆炸时间第二行显示,还剩第三行显示,00时,00分,00秒第四行显示,周林按下旋钮开关,开始设定秒,秒编辑位闪动。
左右旋转设定数值,在按下开关,秒确定,设定分,分编辑位闪动左右调数值,再按下,分确定,小时位闪动。
左右转调小时,再按一下。
时间确定,开始倒计时。
到达定时时间后停止,并闪动。
#include <reg52.h>#include <intrins.h>/********************* 定义********************************/#define LCD_data P0 //数据口sbit LCD_RS = P2 ^ 0; //寄存器选择输入sbit LCD_RW = P2 ^ 1; //液晶读/写控制sbit LCD_EN = P2 ^ 2; //液晶使能控制sbit LCD_PSB = P2 ^ 3; //串/并方式控制sbit LCD_RST = P2 ^ 5; //液晶复位端口sbit sset=P3^4;//设置按钮sbit spk=P1^4;sbit sadd=P2^7;sbit sdel=P2^6;signed char second=0,minute=0,hour=0,count=0,keycount=0;signed char key=0;unsigned char code DIS1[] ={"距离系统爆炸时间"};unsigned char code DIS2[] ={"还剩:"};unsigned char code DIS31[] ={"时"};unsigned char code DIS32[] ={"分"};unsigned char code DIS33[] ={"秒"};unsigned char code DIS4[] ={"周林"};unsigned char code table2[]="0123456789";char code reserve[3]_at_ 0x3b; //保留0x3b开始的3个字节/*********************延时子函数**************************/void delayNOP()//us延时子函数(4.34us){_nop_();_nop_();_nop_();_nop_();}void delayms(unsigned int ms)//ms延时子函数{unsigned char y;while (ms--){for (y = 0; y < 114; y++);}}//******************检查LCD忙状态**************************bit lcd_busy()//检查LCD忙状态1忙,0闲{bit result;LCD_RS = 0;LCD_RW = 1;LCD_EN = 1;delayNOP();result = (bit)(P0 &0x80);LCD_EN = 0;return (result);//***********************写指令数据***********************void lcd_wcmd(unsigned char cmd)//写指令数据到LCD{while (lcd_busy()){;}LCD_RS = 0;LCD_RW = 0;LCD_EN = 1;P0 = cmd;delayNOP();LCD_EN = 0;}void lcd_wdat(unsigned char dat)//写显示数据到LCD{while (lcd_busy());LCD_RS = 1;LCD_RW = 0;LCD_EN = 1;P0 = dat;delayNOP();LCD_EN = 0;}void writesmh(unsigned char add,unsigned char date)//显示个位和十位数据{unsigned char shi,ge;shi=date/10;ge=date%10;lcd_wcmd(0x80+add);delayms(5);lcd_wdat(table2[shi]);delayms(5);lcd_wdat(table2[ge]);delayms(5);}//*********************初始化设定****************************void lcd_init(){LCD_PSB = 1; //并口方式LCD_RST = 0; //液晶复位delayms(5); //液晶复位LCD_RST = 1; //液晶复位delayms(5); //液晶复位lcd_wcmd(0x34); //扩充功能设定,扩充指令,选8位数据delayms(5);lcd_wcmd(0x30); //功能设定,基本指令操作,选8位数据delayms(5);lcd_wcmd(0x0C); //显示开,关光标,关光标反白允许。
LCD12864显示程序(汇编语言)
;实验目的:熟悉12864LCD的使用;12864LCD带中文字库;编程让12864LCD显示公司名称“深圳乾龙盛电子”,公司电话“5”,公司传真“6”;硬件设置:;关断所有拨码开关。
#include<p16f877a.inc>;__CONFIG_DEBUG_OFF&_CP_ALL&_WRT_HALF&_CPD_ON&_LVP_OFF&_BODEN_OFF&_PWRTE_ON&_WDT_OFF&_H S_OSC;芯片配置字,看门狗关,上电延时开,掉电检测关,低压编程关,加密,4M晶体HS振荡 #define RS PORTA,5 ;命令/数据选择#DEFINE RW PORTA,4 ;读/写选择#DEFINE E PORTA,3 ;使能信号#DEFINE PSB PORTA,2 ;并口/串口选择(H/L)#DEFINE RST PORTA,0 ;复位信号;-----------------------------------------------LCD_X EQU 30H ;页地址LCD_Y EQU 31H ;Y地址COUNT EQU 32H ;循环计数用COUNT1 EQU 33H ;循环计数用COUNT2 EQU 34H ;循环计数用POINT EQU 35H ;查表偏移地址POINT1 EQU 36H ;查表偏移地址POINT2 EQU 37H ;查表偏移地址TEMP EQU 38H ;临时寄存器TEMP1 EQU 39H ;临时寄存器;-----------------------------------------------ORG 0000H ;复位地址NOP ;ICD需要的空指令GOTO MAIN ;跳转到主程序;**********************主程序************************MAINBANKSEL TRISACLRF TRISA ;A口输出CLRF TRISD ;D口输出BANKSEL ADCON1MOVLW 06HMOVWF ADCON1 ;A口全为数字口CLRF STATUSBCF RST ;复位LCDCALL DELAY ;延时一段时间BSF RST ;清除复位信号NOPBSF PSB ;并口通讯;**************************初始化**********************MOVLW 30H ;基本指令操作CALL SEND_IMOVLW 01H ;清除显示CALL SEND_IMOVLW 06H ;指定在写入或读取时,光标的移动方向 CALL SEND_IMOVLW 0CH ;开显示,关光标,不闪烁CALL SEND_I;***********************显示汉字************************HAN_WR2CALL CLEAR_P ;清屏HAN_WR2A ;“深圳乾龙盛电子”MOVLW LOW(TAB1A)MOVWF POINTMOVLW HIGH(TAB1A)MOVWF POINT1 ;获取表格的首地址MOVLW 0eH ;数数据字节个数(7个汉字共14字节) MOVWF COUNTMOVLW 81H ;页地址CALL SEND_ICALL QUSHUHAN_WR2B ;“。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
/////////////////////////////////////////////////////程序编写人:小艾//程序编写时间:2012-5-16//程序实现的功能:12864的显示,汇编//////////////////////////////////////////////////////// SECOND EQU 45HMINUTE EQU 46HHOUR EQU 47HCSA EQU P3.2CSB EQU P3.3RS EQU P3.6RW EQU P3.5E EQU P3.4OUTPUT EQU P2COM EQU 21HDAT EQU 22Hcodes EQU 23hcolumn EQU 24Hpagef EQU 25hcpage EQU 26Hccolumn E QU 27Hcolumn2 EQU 28Hpagef2 EQU 29hcpage2 EQU 2aHccolumn2 EQU 2bHCOUNT EQU 2cHCOUNT1 EQU 2DHCOUNT2 EQU 2EHcolumn1 EQU 30Hpagef1 EQU 31hcpage1 EQU 32Hccolumn1 EQU 33Hcolumn3 EQU 34Hpagef3 EQU 35hcpage3 EQU 36Hccolumn3 EQU 37HSHUJI1 EQU 50HSHUJI2 EQU 51HSHUJI3 EQU 52HSHUJI4 EQU 53HSHUJI5 EQU 54HSHUJI6 EQU 55HKEY1 BIT P1.3KEY2 BIT P1.4KEY3 BIT P1.5BT0 BIT 20H.0BT1 BIT 20H.1BT2 BIT 20H.2BT3 BIT 20H.3BT4 BIT 20H.4BT5 BIT 20H.5BT6 BIT 20H.6/////////////////////////////////////////////////ORG 0000HLJMP STARTORG 000BHAJMP INTP0ORG 0030H;*********************************************主程序开始START: MOV TMOD,#01HMOV TH0,#(65536-50000) / 256MOV TL0,#(65536-50000) MOD 256SETB EASETB ET0SETB TR0LCALL INT ;调用初始化子程序LCALL CLEAR ;调用清屏子程序CALL DISPLAY1CALL DECALL DE// CALL LOPP2// CALL LOPP1//////////////////////////////////////////////MAIN: CALL CHULICALL DISPLAYCALL KEYSCANCALL KEYCHULI1CALL KEYCHULI11CALL KEYCHULI2CALL KEYCHULI21MOV COM,#00CALL PRR0CALL PRM0AJMP MAIN///////////////////显示“星”///////////////////////////// DISPLAY1:MOV CODES,#0MOV column1,#00MOV pagef1,#0MOV CODES,#0lcall writeleft1//////////////////显示“梦”////////////////////////////////// MOV CODES,#0mov column1,#16mov pagef1,#0MOV CODES,#1lcall writeleft1//////////////////显示“奕”/////////////////////////////MOV CODES,#0mov column1,#32mov pagef1,#0MOV CODES,#2lcall writeleft1////////////////显示“缘”/////////////////////////////MOV CODES,#0mov column1,#48mov pagef1,#0MOV CODES,#3lcall writeleft1/////////////////////显示“:”/////////////////////////////// MOV CODES,#0// mov column,#16// mov pagef,#2// MOV CODES,#11// lcall writeleft////////////////////显示“:”/////////////////////////////// MOV CODES,#0// mov column,#40// mov pagef,#2// MOV CODES,#11// lcall writeleft/////////////////显示“从”/////////////////////////////MOV CODES,#0mov column1,#0mov pagef1,#4MOV CODES,#4lcall writeleft1/////////////////显示“机”///////////////////////////////MOV CODES,#0mov column1,#16mov pagef1,#4MOV CODES,#5lcall writeleft1////////////////显示“一”/////////////////////////////////MOV CODES,#0mov column1,#32mov pagef1,#4MOV CODES,#6lcall writeleft1/////////////////显示“从”///////////////////////////MOV CODES,#0mov column1,#0mov pagef1,#6MOV CODES,#4lcall writeleft1////////////////显示“机”////////////////////////////////MOV CODES,#0mov column1,#16mov pagef1,#6MOV CODES,#5lcall writeleft1///////////////显示“二”//////////////////////////////////MOV CODES,#0mov column1,#32mov pagef1,#6MOV CODES,#7lcall writeleft1// RET//////////////显示“LED灭”//////////////////////////////////////// LOPP2: MOV CODES,#0mov column3,#00mov pagef3,#4MOV CODES,#11lcall writeright1MOV CODES,#0mov column3,#8mov pagef3,#4MOV CODES,#12lcall writeright1MOV CODES,#0mov column3,#16mov pagef3,#4MOV CODES,#13lcall writeright1MOV CODES,#0mov column3,#40mov pagef3,#4MOV CODES,#10lcall writeright1// RET///////////////显示“LED亮”///////////////////////////////////// LOPP1: MOV CODES,#0mov column3,#0mov pagef3,#6MOV CODES,#11lcall writeright1MOV CODES,#0mov column3,#8mov pagef3,#6MOV CODES,#12lcall writeright1MOV CODES,#0mov column3,#16mov pagef3,#6MOV CODES,#13lcall writeright1MOV CODES,#0mov column3,#40mov pagef3,#6MOV CODES,#9lcall writeright1RET////////////////////////////////////////////////////DISPLAY: MOV CODES,#0MOV SHUJI1,#0CLR AMOV A,SECONDMOV B,#10DIV ABMOV A,BMOV SHUJI1,AMOV column,#56MOV pagef,#2MOV CODES,SHUJI1 ;秒低位CALL writeleftMOV SHUJI2,#0MOV CODES,#0CLR AMOV A,SECONDMOV B,#10DIV ABMOV SHUJI2,AMOV column,#48MOV pagef,#2MOV CODES,SHUJI2 ;秒高位CALL writeleftMOV CODES,#0MOV column,#16MOV pagef,#2 ;显示:MOV CODES,#11CALL writeleftMOV CODES,#0MOV SHUJI3,#0CLR AMOV A,MINUTEMOV B,#10DIV ABMOV A,BMOV SHUJI3,AMOV column,#32MOV pagef,#2MOV CODES,SHUJI3 ;分低位CALL writeleftMOV SHUJI4,#0MOV CODES,#0CLR AMOV A,MINUTEMOV B,#10DIV ABMOV SHUJI4,AMOV column,#24MOV pagef,#2MOV CODES,SHUJI4 ;分高位CALL writeleftMOV CODES,#0MOV column,#40MOV pagef,#2 ;显示:MOV CODES,#11CALL writeleftMOV CODES,#0MOV SHUJI5,#0CLR AMOV A,HOURMOV B,#10DIV ABMOV A,BMOV SHUJI5,Amov column,#8mov pagef,#2MOV CODES,SHUJI5 ;时低位lcall writeleftMOV SHUJI6,#0MOV CODES,#0CLR AMOV A,HOURMOV B,#10DIV ABMOV SHUJI6,AMOV column,#00MOV pagef,#2MOV CODES,SHUJI6 ;时高位CALL writeleftRET////////////////////////////////////////////////writeleft1: ; 左半屏写入16*16数字子程序MOV DPTR,#TABLE2PUSH column1MOV cpage1,#2MOV ccolumn1,#0MOV A,pagef1ANL A,#07hORL A,#0b8hMOV COM,ACALL prm0MOV A,column1ORL A,#40hMOV COM,ACALL prm0MOV a,codesMOV b,#32MUL ABADD A,DPLMOV DPL,AMOV A,BADDC A,DPHMOV DPH,AlOOp3: MOV A,#00hMOVC A,@A+DPTRMOV DAT,ACALL prm1INC ccolumn1MOV A,ccolumn1INC DPTRCJNE A,#16,lOOp3CLR CYDEC cpage1INC pagef1MOV A,cpage1CJNE A,#0,DD1RET//////////////////////////////////////////////DD1: MOV A,pagef1ANL A,#07hORL A,#0b8hMOV COM,ACALL prm0POP column1MOV A,column1ANL A,#3fhORL A,#40hMOV COM,ACALL prm0MOV ccolumn1,#0AJMP lOOp3//////////////////////////////////////////////writeright1: ; 右半屏写入16*16数字子程序MOV DPTR,#TABLE2push column3MOV cpage3,#2MOV ccolumn3,#0MOV A,pagef3ANL A,#07hORL A,#0b8hMOV COM,ACALL prr0MOV A,column3ORL A,#40hMOV COM,ACALL prr0MOV a,codesMOV b,#32MUL ABADD A,DPLMOV DPL,AMOV A,BADDC A,DPHMOV DPH,AlOOp4: MOV A,#00hMOVC A,@A+DPTRMOV DAT,ACALL prr1INC DPTRINC ccolumn3MOV A,ccolumn3CJNE A,#16,lOOp4CLR CYDEC cpage3INC pagef3MOV A,cpage3CJNE A,#0,DD2RET/////////////////////////////////////////////DD2: MOV A,pagef3ANL A,#07hORL A,#0b8hMOV COM,ACALL prr0POP column3MOV A,column3ANL A,#3fhORL A,#40hMOV COM,ACALL prr0MOV ccolumn3,#0AJMP lOOp4///////////////////////////////////////////// writeleft: ; 左半屏写入8*16数字子程序MOV DPTR,#TABLE1PUSH columnMOV cpage,#2MOV ccolumn,#0MOV A,pagefANL A,#07hORL A,#0b8hMOV COM,ACALL prm0MOV A,columnORL A,#40hMOV COM,ACALL prm0MOV A,codesMOV B,#16MUL ABADD A,DPLMOV DPL,AMOV A,BADDC A,DPHMOV DPH,A//////////////////////////////////////////////////// LOOP1: MOV A,#00hMOVC A,@A+DPTRMOV DAT,ACALL prm1INC DPTRINC ccolumnMOV A,ccolumnCJNE A,#8,LOOP1CLR CYDEC cpageINC pagefMOV A,cpageCJNE A,#0,DD3RET/////////////////////////////////////DD3: MOV A,pagefANL A,#07hORL A,#0b8hMOV COM,ACALL prm0POP columnMOV A,columnANL A,#3fhORL A,#40hMOV COM,ACALL prm0MOV ccolumn,#0AJMP LOOP1//////////////////////////////////////////////////writeright: ; 右半屏写入8*16数字子程序// mov dptr,#table1// push column2// mov cpage2,#2// mov ccolumn2,#0// mov a,pagef2// anl a,#07h// orl a,#0b8h// mov com,a// lcall prr0// mov a,column2// orl a,#40h// mov com,a// lcall prr0// mov a,codes// mov b,#16// mul ab// add a,dpl// mov dpl,a// mov a,b// addc a,dph// mov dph,a////lOOp2:// mov a,#00h// movc a,@a+dptr// mov dat,a// lcall prr1// inc ccolumn2// mov a,ccolumn2// inc dptr// cjne a,#8,lOOp2// dec cpage2// inc pagef2// mov a,cpage2// jz over2// mov a,pagef2// anl a,#07h// orl a,#0b8h// mov com,a// lcall prr0// pop column2// mov a,column2// orl a,#40h// mov com,a// lcall prr0// mov ccolumn2,#0// ljmp lOOp2//over2:// ret//////////////////////////////////////////////PRM0: CALL DECLR CSA ;写指令代码子程序(左)SETB CSBCLR RSCLR RWMOV OUTPUT,COMSETB ECLR ERET///////////////////////////////////////////////PRM1: CALL DECLR CSA ;写显示数据子程序(左)SETB CSBSETB RSCLR RWMOV OUTPUT,DATSETB ECLR ERET////////////////////////////////////////////////CLR CSB ;写指令代码子程序(右)SETB CSACLR RSCLR RWMOV OUTPUT,COMSETB ECLR ERETPRR1: CALL DECLR CSB ;写显示数据子程序(右)SETB CSASETB RSCLR RWMOV OUTPUT,DATSETB ECLR ERET////////////////////////////////////////////DE: MOV R7,#10DEE2: MOV R6,#25DJNZ R6,$DJNZ R7,DEE2RET////////////////////////////////////////////CLEAR: MOV R4,#00H ;清屏子程序CLEAR1: MOV A,R4ORL A,#0B8HMOV COM,ALCALL PRM0LCALL PRR0MOV COM,#40HLCALL PRM0LCALL PRR0MOV R3,#40HCLEAR2: MOV DA T,#00HLCALL PRM1LCALL PRR1DJNZ R3,CLEAR2INC R4CJNE R4,#08H,CLEAR1RET///////////////////////////////////////////////////INT: MOV COM,#0C0H ;初始化子程序,设置显示起始行为第一行LCALL PRR0MOV COM,#3FH ;开显示设置LCALL PRM0LCALL PRR0RET////////////////定时器中断子程序//////////////////////////////// INTP0: MOV TH0,#(65536-50000) / 256MOV TL0,#(65536-50000) MOD 256INC COUNTMOV A,COUNTCJNE A,#20,LOPMOV COUNT,#0SETB BT6LOP: RETI/////////////////////////////////////////////////CHULI: JNB BT6,CHU0CLR BT6INC SECONDMOV A,SECONDCJNE A,#60,LOPMOV SECOND,#0INC MINUTEMOV A,MINUTECJNE A,#60,LOPMOV MINUTE,#0INC HOURMOV A,HOURCJNE A,#24,LOPMOV HOUR,#1CHU0: RET//////////////////按键处理模式//////////////////////////////// KEYSCAN: JB BT0,K11JB KEY1,K12SETB BT0RETK12: CLR BT0CLR BT1RETK11: JB KEY1,K12JB BT1,K13SETB BT1INC COUNT1MOV A,COUNT1MOV COUNT1,#0K13: RET////////////////分加///////////////////////// KEYCHULI1:MOV A,COUNT1CJNE A,#1,K23JB BT2,K21JB KEY2,K22SETB BT2RETK22: CLR BT2CLR BT3RETK21: JB KEY2,K22JB BT3,K23SETB BT3INC MINUTEMOV A,MINUTECJNE A,#60,K23MOV MINUTE,#0 K23: RET//////////////////时加///////////////////////////////// KEYCHULI11:MOV A,COUNT1CJNE A,#1,K33JB BT4,K31JB KEY3,K32SETB BT4RETK32: CLR BT4CLR BT5RETK31: JB KEY3,K32JB BT5,K33SETB BT5INC HOURMOV A,HOURCJNE A,#24,K33MOV HOUR,#0K33: RET/////////////////分减/////////////////////////////// KEYCHULI2:MOV A,COUNT1CJNE A,#2,K43JB BT2,K41SETB BT2RETK42: CLR BT2CLR BT3RETK41: JB KEY2,K42JB BT3,K43SETB BT3DEC MINUTEMOV A,MINUTECJNE A,#0FFH,K43MOV MINUTE,#59K43: RET///////////////时减///////////////////////////KEYCHULI21:MOV A,COUNT1CJNE A,#2,K53JB BT4,K51JB KEY3,K52SETB BT4RETK52: CLR BT4CLR BT5RETK51: JB KEY3,K52JB BT5,K53SETB BT5DEC HOURMOV A,HOURCJNE A,#0FFH,K53MOV HOUR,#23K53: RET;*************************************字模表table1: ;数字字模表DB 0F0h,0F8h, 0Ch,04h,04h,0Ch,0F8h,0F0h,0Fh,1Fh,30h,20h,20h,30h,1Fh,0Fh ;0 /* (8 X 16 , 宋体)*/DB 00h,00h,08h,0F8h,0FCh,00h,00h,00h,00h,00h,20h,3Fh,3Fh,20h,00h,00h ;1 /* (8 X 16 , 宋体)*/DB 30h,38h,0Ch,04h,04h,0Ch,0F8h,0F0h,20h,30h,38h,2Ch,26h,23h,21h,38h ;2 /* (8 X 16 , 宋体)*/DB 10h,18h,0Ch,84h,84h,0CCh,78h,30h,08h,18h,30h,20h,20h,31h,1Fh,0Eh ;3/* (8 X 16 , 宋体)*/DB 00h,0C0h,70h,18h,0FCh,0FEh,00h,00h,07h,05h,04h,24h,3Fh,3Fh,24h,04h ;4 /* (8 X 16 , 宋体)*/DB 0FCh,0FCh,0C4h,44h,44h,0C4h,84h,04h,08h,18h,30h,20h,20h,30h,1Fh,0Fh ;5 /* (8 X 16 , 宋体)*/DB 0F0h,0F8h,8Ch, 44h,44h,0CCh,98h,10h,0Fh,1Fh,30h,20h,20h,30h,1Fh,0Fh ;6 /* (8 X 16 , 宋体)*/DB 1Ch,0Ch,0Ch,0Ch,0CCh,0ECh,3Ch,1Ch,00h,00h,3Ch,3Fh,03h,00h,00h,00h ;7 /* (8 X 16 , 宋体)*/DB 30h,78h,0CCh,84h,84h,0CCh,78h,30h,0Eh,1Fh,31h,20h,20h,31h,1Fh,0Eh ;8 /* (8 X 16 , 宋体)*/DB 0F0h,0F8h,0Ch,04h,04h,0Ch,0F8h,0F0h,08h,19h,33h,22h,22h,33h,1Fh,0Fh ;9 /* (8 X 16 , 宋体)*/DB 0F0h,0F8h,0Ch,04h,04h,0Ch,0F8h,0F0h,0Fh,1Fh,30h,20h,20h,30h,1Fh,0Fh ;10 /* (8 X 16 , 宋体)*/DB 00H ,00H ,00H ,0C0H ,0C0H ,00H, 00H ,00H ,00H ,00H, 00H ,30H ,30H ,00H ,00H ,00H;":",11/* (8 X 16 , 宋体)*/table2: ;汉字DB 00H,00H,00H,0BEH,2AH,2AH,2AH,0EAH,2AH,2AH,2AH,2AH,3EH,00H,00H,00H;DB 00H,48H,46H,41H,49H,49H,49H,7FH,49H,49H,49H,49H,49H,41H,40H,00H;"星",0/* (16 X 16 , System )*/DB 40H,44H,24H,14H,0FFH,94H,64H,40H,24H,14H,0FFH,0CH,34H,64H,24H,00H;DB 00H,80H,88H,88H,46H,45H,29H,31H,11H,09H,05H,03H,01H,00H,00H,00H;"梦",1/* (16 X 16 , System )*/DB 40H,44H,24H,94H,44H,3CH,05H,46H,84H,7CH,04H,14H,64H,24H,04H,00H;DB 00H,84H,85H,44H,24H,14H,0CH,07H,0CH,14H,24H,64H,0C4H,44H,04H,00H;"奕",2/* (16 X 16 , System )*/DB 20H,38H,0A7H,62H,10H,20H,0A0H,6CH,6BH,0AAH,2AH,3AH,26H,0A0H,20H,00H;DB 12H,13H,12H,0AH,29H,25H,12H,12H,49H,85H,7FH,02H,0DH,18H,08H,00H;"缘",3/* (16 X 16 , System )*/DB 00H,00H,00H,00H,0FFH,00H,00H,00H,80H,7FH,80H,00H,00H,00H,00H,00H;DB 40H,20H,18H,07H,80H,41H,36H,18H,07H,00H,01H,06H,18H,70H,20H,00H;"从",4/* (16 X 16 , System )*/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;"机",5/* (16 X 16 , System )*/DB 00H,80H,80H,80H,80H,80H,80H,80H,80H,80H,80H,80H,80H,0C0H,80H,00H;DB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H;"一",6/* (16 X 16 , System )*/DB 00H,00H,04H,04H,04H,04H,04H,04H,04H,04H,04H,06H,04H,00H,00H,00H;DB 00H,10H,10H,10H,10H,10H,10H,10H,10H,10H,10H,10H,10H,18H,10H,00H;"二",7/* (16 X 16 , System )*/DB 00h,00h,00h,00h,00h,00h,00h,30h,30h,00h,00h,00h,00h,00h,00h,00h ; ":",8DB 00h,00h,00h,00h,00h,00h,00h,0Ch,0Ch,00h,00h,00h,00h,00h,00h,00h;/* (16 X 16 , 宋体)*/DB00H,82H,82H,82H,0BAH,0AAH,0AAH,0ABH,0AAH,0AAH,0BAH,82H,82H,0C2H,80H,00H; DB 02H,41H,40H,20H,10H,0EH,02H,02H,02H,3EH,40H,40H,42H,41H,70H,00H;"亮",9/* (16 X 16 , 宋体)*/DB 00H,02H,02H,0E2H,02H,02H,82H,7EH,0C2H,02H,82H,42H,33H,02H,00H,00H;DB 00H,40H,21H,10H,08H,06H,01H,00H,00H,03H,0CH,18H,30H,60H,20H,00H;"灭",10/* (16 X 16 , 宋体)*/DB 08H ,0F8H, 08H ,00H, 00H ,00H ,00H ,00H, 00H, 00H ,00H, 00H, 00H ,00H, 00H, 00H;DB 20H ,3FH ,20H ,20H ,20H ,20H, 30H, 00H ,00H ,00H ,00H ,00H ,00H, 00H ,00H, 00H;"L",11/* (16 X 16 , 宋体)*/DB 08H ,0F8H ,88H, 88H ,0E8H ,08H ,10H ,00H ,00H ,00H ,00H ,00H, 00H ,00H, 00H ,00H; DB 20H ,3FH ,20H, 20H ,23H ,20H ,18H ,00H ,00H ,00H ,00H ,00H, 00H ,00H ,00H ,00H;"E",12/* (16 X 16 , 宋体)*/DB 08H ,0F8H ,08H ,08H ,08H ,10H ,0E0H ,00H ,00H ,00H ,00H ,00H ,00H ,00H, 00H,00H; DB20H ,3FH ,20H ,20H ,20H ,10H ,0FH ,00H ,00H ,00H ,00H ,00H ,00H ,00H ,00H ,00H;"D",13/* (16 X 16 , 宋体)*//////////////////////////////////////////////////////////////// END。