无字库12864程序
菜鸟学习51单片机之12864液晶(无字库)
/* 选择屏幕来清屏 */
菜鸟学习 51 单片机
while(1)世界
void Lcd12864Clear(uint8 selet)
{
uint8 i,j;
Lcd12864SeletScreen(selet); //选择屏,分左屏和又屏,这个函数在程序中有
for(i = 0;i < 8 ;i++)
二.写入地址
void Lcd12864Point(uint8 page,uint8 x,uint8 y)
{
Lcd12864Write(CMD,0xb8 + page);
//确定页
Lcd12864Write(CMD,0xC0 + x);
//设定起始行
Lcd12864Write(CMD,0x40 + y);
菜鸟学习 51 单片机
while(1)世界
现在开始讲解如何使用,看这篇讲解前,请先到网盘去下载本教 程的仿真图和程序,结合起来更容易明白。
上图是仿真的结果。 在仿真软件中找出的 12864 液晶是没有字库的,对于仿真软件中 液晶的控制和平常的有点不同。一块液晶是由两块 64×64 的液晶显 示模块组合而成。下面是各管脚的介绍。
//有 8 页,循环 8 次
{
Lcd12864Point(i,0,0); //这个就是上面讲到的函数,确定位置
for(j = 0 ;j < 64;j++) //每一块液晶显示模块有 64 列
{
Lcd12864Write(DAT,0x00); //写入 0x00 来清屏
}
}
}
具体的使用如下:初始化函数中调用了清全屏 Lcd12864Clear(3); //清全屏
FYD12864无字库3A中文使用手册
FYD12864-0403A 液晶显示模块服务文件实物图片一.基本特性* 电源电压5V* 显示分辨率:128×64点* 显示方式:STN、半透、正显* 驱动方式:1/64DUTY,1/9BIAS* 视角方向:6点* 背光方式:底部黄绿LED背光* 通讯方式:8线并口* 内置DC-DC转换电路,无需外加负压* 工作温度:-10℃ - +60℃ ,存储温度: -20℃ - 70℃二.外形尺寸1.外形尺寸图2.主要外形尺寸项 目 标 准 尺 寸 单 位模 块 体 积 93.0×70.0×12.8 mm定 位 尺 寸 88.0×65.0 mm视 域 71.7×39 mm点 阵 数 128×64 像素点 距 离 0.52×0.52 mm点 大 小 0.48×0.48 mm三.硬件说明1.引脚特性引脚号 引脚名称 电 平 引 脚 功 能 描 述1 VSS 0V 电源地2 VDD +5V 电源电压3 V0 0~-10V LCD驱动负电压,调节LCD对比度4 D/I H/L H:DB0-DB7为显示数据L:DB0-DB7为显示指令数据5 R/W H/L R/W=H,E=H数据被读到DB0-DB7R/W=L,E=H—L,DB0-DB7数据写到IR或DR6 E H/L 使能信号:R/W=L.E信号下降沿锁存DB0-DB7;R/W=H,E=H,DDRAM数据读到DB0-DB77 DB08 DB19 DB210 DB3H/L 8位三态并行数据总线11 DB412 DB513 DB614 DB715 CS1 H/L 片选信号,当CS1=H时,液晶右半屏显示16 CS2 H/L 片选信号,当CS2=H时,液晶左半屏显示17 /RET H/L 复位信号,RET=0有效18 VEE -10V 输出-10V的负电压(单电源供电)19 A +5V背光电源,背光功耗≤300mA20 K 0V2.原理简图背光接线图 3.硬件功能描述1)显示数据RAM(DDRAM)DDRAM(64×8×8 bits)是存储图形显示数据的。
protues中无字库12864汉字显示程序
lie1=0;
}
page=5;
lie1=0;
for(i=0;i<8;i++)
{
if(i<4)
screen(0);
else
screen(1);
show1616(page,lie1,address);
lie1+=16;
if(lie1>63)
lie1=0;
address+=32;
}
screen(2);
{
uchar i;
page(pa);
lie(li);
for(i=0;i<16;i++)
dat(*(add++));
page(pa+1);
lie(li);
for(i=0;i<16;i++)
dat(*(add++));
}
void main()
{
uchar i,page,lie1;
uchar *address;
}
void line(uchar line)
{
line=line&0x3f;
line=line|0xc0;
com(line);
}
void onoff(uchar onoff)
{
if(onoff==1)
com(0x3f);
else
com(0x3e);
}
void reset()
{
reset1=0;
delay(2);
0x80,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x03,0x0C,0x10,0x20,0x40,0x80,0x80,0x00,
不带字库12864程序实例
/******************************************************************** *************************///程序部分开始///******************************************************************** *************************//头文件定义///******************************************************************** *************************/#include <reg52.h> // 包含头文件#include <string.h> //用于指针/******************************************************************** *************************//接口定义///******************************************************************** *************************/#define LCM12864_DB7_DB0 P0 // 定义LCM12864的数据总线sbit LCM12864_RS = P2 ^ 3; // 定义LCM12864的RS控制线sbit LCM12864_RW = P2 ^ 4; // 定义LCM12864的RW控制线sbit LCM12864_E = P2 ^ 2; // 定义LCM12864的E控制线sbit LCM12864_CS1 = P2 ^ 7; // 定义LCM12864的CS1控制线sbit LCM12864_CS2 = P2 ^ 6; // 定义LCM12864的CS2控制线sbit LCM12864_RESET = P2 ^ 5; // 定义LCM12864的RESET控制线sbit LCM12864_LEDK = P2 ^ 0; // 定义LCM12864的LEDK(BLK)控制线/******************************************************************** *************************//数据定义//定义LCM12864的命令字/******************************************************************** *************************/#define LCM12864_DISP_ON 0x3f // 打开LCM12864显示#define LCM12864_DISP_OFF 0x3e // 关闭LCM12864显示#define LCM12864_START_ROW 0xc0 // 显示起始行0,可以用LCM12864_START_ROW+x设置起始行。
12864程序
硬件连接方式是:并口直接访问。
这是汉字显示程序:#include<reg51.h>#include<absacc.h>#define uchar unsigned char#define datawr 0x1200 //写数据通道#define comwr 0x1000 //写控制命令通道#define datare 0x1300 //读数据通道#define comre 0x1100 //读忙通道uchar code disp_data[]={" 浙江大学" //第一行,第一页"04级通信工程一班" //第三行" 宁波理工学院" //第二行" 竞赛小组" //第四行"128X64液晶显示器" //第一行,第二页" 测试程序" //第三行" 07年07月25日" //第二行" Tornado "}; //第四行void set12864();void write_command(uchar command);void write_page(uchar data_add);void read_page(uchar data_add);void delays(uchar cont);void main(){while(1){set12864(); //初始化12864write_page(0); //写入一页数据read_page(0x30); //读出一页数据到内部RAMdelays(2); //延时2swrite_page(64); //写入下一页数据delays(2); //延时2s}}//初始化12864子程序void set12864(){write_command(0x30); //功能设定控制字write_command(0x0c); //显示开关控制字write_command(0x01); //清除屏幕控制字write_command(0x06); //进入设定点控制字}//写控制命令子程序void write_command(uchar command){bit flag=1; //12864空闲标志位while(flag) //检查12864是否空闲flag="XBYTE"[comre]&0x80;XBYTE[comwr]=command; //空闲传送控制字}//写一页子程序void write_page(uchar data_add){bit flag=1; //12864空闲标志位uchar num=64; //64个循环,连续写入32个汉字或是64个西文字符write_command(0x80);for(;num>0;num--){while(flag) //检查12864是否空闲flag="XBYTE"[comre]&0x80;XBYTE[datawr]=disp_data[data_add++]; //空闲传送数据}}//读一页子程序void read_page(uchar data_add){bit flag=1; //12864空闲标志位uchar num=64; //64个循环,连续写入32个汉字或是64个西文字符write_command(0x80);for(;num>0;num--){while(flag) //检查12864是否空闲flag="XBYTE"[comre]&0x80;DBYTE[data_add++]=XBYTE[datare]; //空闲传送数据}}//延时cont秒子程序void delays(uchar count){unsigned char h,i,j,k;do{for(h=5;h>0;h--)for(i=4;i>0;i--)for(j=116;j>0;j--)for(k=214;k>0;k--);}while(--count);}这是图象显示程序:#include<reg51.h>#include<absacc.h>#define uchar unsigned char#define uint unsigned int#define datawr 0x1200 //写数据通道#define comwr 0x1000 //写控制命令通道#define datare 0x1300 //读数据通道#define comre 0x1100 //读忙通道uchar code disp_data[] = // 数据表{0x00,0x01,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00 ,0x00,0x00,0x00,0x00,0x01,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00 ,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0,0x00 ,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x00 ,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00 ,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0x00 ,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x0 0,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x8 0,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF F,0xFF,0xFF,0xFF,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF F,0xFF,0xFF,0xFF,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0 3,0xFF,0xFF,0xFF,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0 0,0x07,0xFF,0xFF,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x8 0,0x00,0x0B,0xFF,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x8 0,0x00,0x00,0x1F,0x01,0xFF,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC 0,0x00,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xF3,0x79,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC 0,0x00,0x00,0x00,0x03,0xFF,0xFF,0xFF,0xE6,0x62,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE 1,0x60,0x00,0x68,0x01,0xFF,0xFF,0xFE,0x00,0x60,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE1 ,0x00,0x00,0x0E,0x01,0xFF,0xFF,0xF8,0x00,0x4B,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0 ,0x8E,0x08,0x79,0x07,0xFF,0xFF,0xF0,0x00,0x41,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE6 ,0xC0,0x07,0x61,0xC3,0xFF,0xFE,0xC0,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xF F,0xED,0xEF,0x3F,0x83,0xFF,0xFE,0x60,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF ,0xFF,0xFF,0xFF,0xC0,0xFF,0xFD,0xFC,0x6C,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xF F,0xFF,0xFF,0xFF,0xF0,0x7F,0xF3,0xFF,0xFE,0x60,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF ,0xFF,0xFF,0xFF,0xFF,0xFF,0xF3,0xFF,0xFF,0x50,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xF F,0xFF,0xFF,0xC9,0xFB,0xFF,0xF1,0xF8,0x8C,0xD8,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xF F,0xFB,0x6F,0xD9,0xC2,0x3F,0xF8,0x40,0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xF6 ,0xDF,0x1E,0xFF,0xFF,0x7F,0xFC,0x38,0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0x64 ,0x2F,0x6F,0xFF,0xFD,0x7B,0xFC,0x1F,0xE0,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0x5 F,0x7C,0xEE,0xFF,0xC7,0xFF,0xBC,0x0F,0xFF,0x00,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xD F,0xFE,0xEF,0xFF,0xFF,0xE7,0xDC,0x07,0xE7,0xF8,0x12,0x7F,0xFF,0xFF,0xFF,0xFF,0x4 7,0xFF,0xFF,0xFF,0xFF,0xE7,0x80,0x03,0xF4,0x00,0x00,0x5F,0xFF,0xFF,0xFE,0xFE,0xE3 ,0xFF,0xFF,0xFF,0xFF,0xFE,0xC0,0x01,0xC0,0x00,0x00,0x1B,0xFF,0xFF,0xFB,0xFF,0xF F,0xFF,0xFF,0xFF,0x7F,0xEE,0xC0,0x00,0xC0,0x00,0x00,0x03,0xFF,0xFF,0xFF,0xFF,0xFF ,0xFF,0xFF,0xFF,0xFE,0x98,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0xFF,0xEF,0xFF,0xFF, 0xFF,0xFF,0xFF,0x20,0x0E,0x60,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x8F,0xFF,0xFF, 0xFF,0xFF,0xFF,0x05,0x80,0xE0,0x00,0x00,0x00,0x00,0x01,0xFF,0xFD,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0x09,0x80,0xA0,0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0x7F,0xFF,0xFF, 0xFF,0xFF,0xFF,0x85,0x2A,0xC0,0x00,0x00,0x00,0x00,0x01,0xFF,0xFB,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFE,0xBF,0xF3,0xC0,0x00,0x00,0x00,0x00,0x00,0xFF,0xF7,0xFF,0xFF,0xFF, 0xFF,0xFF,0xF8,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x01,0xFF,0xE0,0xFF,0xFF,0xFF, 0xFF,0xFF,0x00,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0xFF,0xC0,0xFF,0xFF,0xFF, 0xFF,0xC0,0x1F,0xFF,0xFF,0x80,0x00,0x40,0x00,0x00,0x00,0xFF,0x80,0xFF,0xFF,0xFF, 0x80,0x07,0xFF,0xFF,0xFF,0xC0,0x00,0xC0,0x00,0x00,0x01,0xFF,0x01,0xFF,0xFF,0xF8 ,0x00,0xFF,0xFF,0xFF,0xFF,0xE0,0x63,0x80,0x00,0x00,0x01,0xFE,0x01,0xFF,0x18,0x00, 0x3F,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x01,0xCC,0x01,0xFE,0x00,0x07, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x07,0xA0,0x03,0xFC,0x00,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x05,0xC0,0x03,0xC8,0x00,0x7F, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x19,0x00,0x00,0x88,0x0C,0x07, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x0C,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0xC0, 0x7F,0xFF,0xFF,0xFF,0xFF,0xF8,0x07,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0 x0F,0xFF,0xFE,0xFF,0xFF,0xD0,0x07,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x0F, 0x03,0xFF,0xF8,0xFF,0xFC,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0 x3F,0xFF,0xC0,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0 x00,0xFF,0xF8,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0 x00,0x1F,0xFE,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x78,0x02,0x00,0x00,0x00,0x00,0 x00,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x03,0xF0,0x78,0x00,0x00,0x00,0x00,0 x00,0x02,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xF0,0x00,0x00,0x00,0x00, 0x00,0x00,0x7F,0xF0,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xC0,0x00,0x00,0x00,0x00, 0x00,0x00,0x1F,0xE0,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0x80,0x00,0x00,0x00,0x00,0 x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0x00,0x00,0x00,0x00,0x00,0 x00,0x00,0x27,0xC0,0x00,0x00,0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0 x00,0x00,0x04,0x80,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0 x00,0x00,0x01};void set12864();void setxy(uchar x,uchar y);void write_command(uchar command);void write_16byte(uint data_add);void delays(uchar count);void main(){uchar x,y,i;while(1){y="0x80"; //设置液晶上半部分坐标x="0x80";delays(2); //延时2sset12864(); //初始化12864delays(2);for(i=0;i<32;i++) //写入液晶上半图象部分{ //写入坐标setxy(x,y);write_16byte(i*16); //连续写入16字节数据y++; //y轴地址加1}y="0x80"; //设置液晶下半部分坐标x="0x88";for(i=0;i<32;i++) //写入液晶下半图象部分{setxy(x,y); //写入坐标write_16byte((32+i)*16);//连续写入16字节数据y++; //y轴地址加1}write_command(0x34); //写入扩充指令命令write_command(0x36); //显示图象}}//初始化12864子程序void set12864(){write_command(0x30); //功能设定控制字write_command(0x0c); //显示开关控制字write_command(0x01); //清除屏幕控制字write_command(0x06); //进入设定点控制字}//设置绘图坐标void setxy(uchar x,uchar y){write_command(0x34); //写入扩充指令命令write_command(y); //写入y轴坐标write_command(x); //写入x轴坐标write_command(0x30); //写入基本指令命令}//写控制命令子程序void write_command(uchar command){bit flag="1"; //12864空闲标志位while(flag) //检查12864是否空闲flag="XBYTE"[comre]&0x80;XBYTE[comwr]=command; //空闲传送控制字}void write_16byte(uint data_add){bit flag="1"; //12864空闲标志位uchar num="16"; //16个循环,连续写入16个字节for(;num>0;num--){while(flag) //检查12864是否空闲flag="XBYTE"[comre]&0x80;XBYTE[datawr]=disp_data[data_add++]; //空闲传送数据}}//延时count秒子程序void delays(uchar count){unsigned char h,i,j,k;do{for(h=5;h>0;h--)for(i=4;i>0;i--)for(j=116;j>0;j--)for(k=214;k>0;k--);}while(--count);}程序代码如下:#include <reg52.h>#include"INTRINS.H"#define uint unsigned int#define uchar unsigned char#define x1 0x80#define x2 0x88#define y 0x80#define comm 0#define dat 1sbit cs = P0^0;sbit std = P0^1;sbit sclk = P0^2;//sbit rst = P0^3; //Reset Signal 低电平有效void wr_lcd (uchar dat_comm,uchar content);void delay (uint us);void lcd_char(uchar x0,uchar y0,uchar k,uchar *chn); void init_lcd (void);void lcd_string(uchar x0,uchar y0,uchar k,uchar *chn);/*------------------初始化-----------------*/void init_lcd (void){// rst=1;wr_lcd (comm,0x30); /*30---基本指令动作*/wr_lcd (comm,0x01); /*清屏,地址指针指向00H*/delay (100);wr_lcd (comm,0x06); /*光标的移动方向*/wr_lcd (comm,0x0c); /*开显示,关游标*/}/*--------------清DDRAM------------------*/void clrram (void){wr_lcd (comm,0x30);wr_lcd (comm,0x01);delay (180);}/*---------------------------------------*/void wr_lcd (uchar dat_comm,uchar content){uchar a,i,j;delay (500);a=content;cs=1;_nop_();sclk=0;_nop_();std=1;_nop_();for(i=0;i<5;i++){sclk=1;_nop_();_nop_();_nop_();sclk=0;}std=0;_nop_();sclk=1;_nop_();_nop_();_nop_();sclk=0;_nop_();if(dat_comm)std=1; //data elsestd=0; //command sclk=1;_nop_();_nop_();_nop_();sclk=0;std=0;_nop_();sclk=1;_nop_();_nop_();_nop_();sclk=0;for(j=0;j<2;j++){for(i=0;i<4;i++) {a=a<<1;std=CY;sclk=1;_nop_();_nop_();_nop_();sclk=0;}std=0;for(i=0;i<4;i++) {sclk=1;_nop_();_nop_();_nop_();sclk=0;}}}/*-----------------------------------*/void delay (uint us) //delay time{while(us--);}void delay1 (uint ms){uint i,j;for(i=0;i<ms;i++)for(j=0;j<15;j++)delay(1);}/*-------在任意位置显示一串汉字------X0为行,Y0为列,chn为所要显示的汉字串 ,k为汉字个数*/void lcd_char(uchar x0,uchar y0,uchar k,uchar *chn) {uchar adr,i;switch(x0){case 0: adr = 0x80 + y0;break; //在第1行y列显示case 1: adr = 0x90 + y0;break; //在第2行y列显示case 2: adr = 0x88 + y0;break; //在第3行y列显示case 3: adr = 0x98 + y0;break; //在第4行y列显示default: ;}wr_lcd (comm,0x30);wr_lcd (comm,adr);for(i=0;i<2*k;i++)wr_lcd (dat,chn[i]);}//在任意位置显示字符串,k为字符个数void lcd_string(uchar x0,uchar y0,uchar k,uchar *chn){uchar adr,i;switch(x0){case 0: adr = 0x80 + y0;break; //在第1行y列显示case 1: adr = 0x90 + y0;break; //在第2行y列显示case 2: adr = 0x88 + y0;break; //在第3行y列显示case 3: adr = 0x98 + y0;break; //在第4行y列显示default: ;}wr_lcd (comm,0x30);wr_lcd (comm,adr);for(i=0;i<k;i++)wr_lcd (dat,chn[i]);}/*------------------主程序--------------------*/ void main (){ uchar chn[4]={0x31,0x32,0x35,0x36};uchar b[]={"欢迎使用本程序"};init_lcd ();while (1){clrram();lcd_char(0,0,7,b);lcd_string(1,0,4,chn);delay1 (8000);}}/*********************************************************************//*文件名称:12864-01-8x8.asm SIDE: 128 X 64 DOTS */ /*模块名:12864-1 模块CONTROLLER: KS0108 */ /*创建人:zmlceo 日期:2008-12-01 *//*QQ:527717539 日期:2008-12-01 *//*功能描述:*//*其他说明:*//*版本:V1.0 *//*********************************************************************///显示/*****************//* *//* 12864lcd *//* *//* *//*****************/#include <reg52.h>#include <ctype.h>#include <string.h>#include <stdlib.h>#include <stdio.h>#include <math.h>/* Define the register command code */#define Disp_On 0x3f#define Disp_Off 0x3e#define Col_Add 0x40#define Page_Add 0xb8#define Start_Line 0xc0#define Lcd_Bus P0 //MCU P1 LCM/*sbit Mcs="P2"^3; //Master chip enablesbit Scs="P2"^4; //Slave chip enablesbit Enable="P2"^0; //6800 mode Enable singlesbit Di="P2"^5; //Data or Instrument Selectsbit RW="P2"^6; //Write or Readsbit Lcd_Rst=P2^2; //Lcm resetsbit Test_Key=P2^1;*/sbit Mcs="P2"^3; //Master chip enablesbit Scs="P2"^4; //Slave chip enablesbit Enable="P2"^2; //6800 mode Enable singlesbit Di="P2"^0; //Data or Instrument Selectsbit RW="P2"^1; //Write or Readsbit Lcd_Rst=P2^5; //Lcm resetsbit Test_Key=P1^0;//;****************************************************************/*;RS REG P2.0 DEFINE LCM DATA/INSTRUCTION PIN ;R/W REG P2.1 DEFINE LCM READ/WRITE PIN;E REG P2.2 DEFINE LCM CHIP ENABLE PIN;CS1 REG P2.3 DEFINE LCM CHIP 1 SELECT PIN;CS2 REG P2.4 DEFINE LCM CHIP 2 SELECT PIN;RSTB REG P2.5 DEFINE LCM /RESET PIN*/char code SHU1[]={/*-- 文字: 1 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20, 0x00,0x00};char code SHU2[]={/*-- 文字: 2 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21, 0x30,0x00};char code SHU8[]={/*-- 文字: 8 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22, 0x1C,0x00};char code SHU6[]={/*-- 文字: 6 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11, 0x0E,0x00};char code SHU4[]={/*-- 文字: 4 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F, 0x24,0x00};char code L[]={/*-- 文字: L --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20, 0x30,0x00};char code C[]={/*-- 文字: C --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00};char code D[]={/*-- 文字: D --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10, 0x0F,0x00};/*****************//* *//* 12864LCD *//* *//* *//*****************//*------------------延时子程序-----------------------------*/void delay(unsigned int t){unsigned int i,j;for(i=0;i<t;i++)for(j=0;j<10;j++);}/*------------------写命令到LCD------------------------------*/void write_com(unsigned char cmdcode){Di=0;RW=0;Lcd_Bus=cmdcode;delay(0);Enable=1;delay(0);Enable=0;}/*-------------------写数据到LCD----------------------------*/ void write_data(unsigned char Dispdata){Di=1;RW=0;Lcd_Bus=Dispdata;delay(0);Enable=1;delay(0);Enable=0;}/*-------------------读LCD数据----------------------------*/ unsigned char read_data(){unsigned char tmpin;Di=1;RW=1;delay(0);Enable=1;delay(0);Enable=0;tmpin=Lcd_Bus;return tmpin;}/*------------------清除内存---------------*/void Clr_Scr(){unsigned char j,k;Mcs=1;Scs=1;write_com(Page_Add+0);write_com(Col_Add+0);for(k=0;k<8;k++){write_com(Page_Add+k);for(j=0;j<64;j++)write_data(0x00);}}/*---------------------指定位置显示字符8*16-----------------------*/void hz_disp816(unsigned char pag,unsigned char col, unsigned char cod e *hzk){unsigned char j="0",i=0;for(j=0;j<2;j++){write_com(Page_Add+pag+j);write_com(Col_Add+col);for(i=0;i<8;i++) write_data(hzk[8*j+i]);}}。
无字库LCD12864(无时钟芯片显示时间)
/************************************************************************** 在无字库的12864LCD上显示时、分、秒;没有用时钟芯片MCU:STC89C52晶振:11.0592MHz作者:罗元俊时间:2014.06.25**************************************************************************/ #include <reg52.h>typedef unsigned char uchar;typedef unsigned int uint;#define Port P0 // 数据端口#define Disp_On 0x3f // 开显示#define Disp_Off 0x3e // 关显示#define Col_Add 0x40 // 列地址#define Page_Add 0xb8 // 页地址#define Start_Line 0xc0 // 起始页sbit RS = P2^6;sbit RW = P2^5;sbit EN = P2^7;sbit CS1 = P3^2;sbit CS2 = P3^3;uint t = 0; //全局变量:秒表(用于计数时间的增量)uchar sec,min,hour; // 全局变量:秒、分、时uchar a,b,c,d,e,f; // 秒、分、时的个位和十位uchar code HZ_tab[][32] = {{/*-- 文字: 潜--*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x20,0xC2,0x0C,0x80,0x10,0x94,0x54,0x3F,0x54,0x90,0x54,0x3F,0x54,0x94,0x10,0x00,0x04,0x04,0x7E,0x01,0x00,0x00,0xFF,0x49,0x49,0x49,0x49,0x49,0xFF,0x00,0x01,0x00},{/*-- 文字: 龙--*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0xF0,0x10,0x11,0x16,0xD0,0x10,0x10,0x00,0x80,0x40,0x20,0x18,0x06,0x41,0x20,0x10,0x3F,0x44,0x42,0x41,0x40,0x40,0x78,0x00},{/*-- 文字: 花--*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x04,0x04,0x04,0x84,0x6F,0x04,0x04,0x04,0xE4,0x04,0x8F,0x44,0x24,0x04,0x04,0x00,0x04,0x02,0x01,0xFF,0x00,0x10,0x08,0x04,0x3F,0x41,0x40,0x40,0x40,0x40,0x78,0x00},{/*-- 文字: 园--*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x00,0xFE,0x02,0x42,0x4A,0xCA,0x4A,0x4A,0xCA,0x4A,0x4A,0x42,0x02,0xFE,0x00,0x00,0x00,0xFF,0x40,0x50,0x4C,0x43,0x40,0x40,0x4F,0x50,0x50,0x5C,0x40,0xFF,0x00,0x00},{/*-- 文字: 输--*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x88,0x68,0x1F,0xC8,0x08,0x10,0xC8,0x54,0x52,0xD1,0x12,0x94,0x08,0xD0,0x10,0x00,0x09,0x19,0x09,0xFF,0x05,0x00,0xFF,0x12,0x92,0xFF,0x00,0x5F,0x80,0x7F,0x00,0x00},{/*-- 文字: 入--*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x00,0x00,0x00,0x00,0x00,0x01,0xE2,0x1C,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x03,0x0C,0x30,0x40,0x80,0x80,0x00},{/*-- 文字: 密--*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x10,0x8C,0x44,0x04,0xE4,0x04,0x95,0xA6,0x44,0x24,0x14,0x84,0x44,0x94,0x0C,0x00,0x02,0x02,0x7A,0x41,0x41,0x43,0x42,0x7E,0x42,0x42,0x42,0x43,0xF8,0x00,0x00,0x00},{/*-- 文字: 码--*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/0x04,0x84,0xE4,0x5C,0x44,0xC4,0x00,0x02,0xF2,0x82,0x82,0x82,0xFE,0x80,0x80,0x00,0x02,0x01,0x7F,0x10,0x10,0x3F,0x00,0x08,0x08,0x08,0x08,0x48,0x88,0x40,0x3F,0x00}};uchar code SZ_tab[][16] = {{/*-- 文字: 0 --*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00}, //0 {/*-- 文字: 1 --*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}, //1 {/*-- 文字: 2 --*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00}, //2 {/*-- 文字: 3 --*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00}, //3 {/*-- 文字: 4 --*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00}, //4{/*-- 文字: 5 --*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00}, //5 {/*-- 文字: 6 --*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00}, //6 {/*-- 文字: 7 --*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00}, //7 {/*-- 文字: 8 --*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00}, //8 {/*-- 文字: 9 --*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00}, //9 {/*-- 文字: - --*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01}, //10 {/*-- 文字: : --*//*-- 新宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00} //11 };void delayms(uint xms) //延时子程序{uint x,y;for(x = xms;x > 0;x--)for(y = 2;y > 0;y--);}void DetBusybit(void) //忙位检测子程序{Port = 0xff; //读状态值时,先给数据端口赋高电平RS = 0;RW = 1;EN = 1;while(Port & 0x80); //如果LCD处于忙状态,程序就此停止delayms(2);EN = 0;}void LCD_WrCom_L(uchar com) // 写左半屏指令子程序{DetBusybit();CS1 = 1; CS2 = 0;RS = 0;RW = 0;EN = 1;Port = com;delayms(5);EN = 0;}void LCD_WrCom_R(uchar com) // 写右半屏指令子程序{DetBusybit();CS1 = 0; CS2 = 1;RS = 0;RW = 0;EN = 1;Port = com;delayms(5);EN = 0;}void LCD_WrDat_L(uchar dat) // 写左半屏数据子程序{DetBusybit();CS1 = 1; CS2 = 0;RS = 1;RW = 0;EN = 1;Port = dat;delayms(5);EN = 0;}void LCD_WrDat_R(uchar dat) // 写右半屏数据子程序{DetBusybit();CS1 = 0; CS2 = 1;RS = 1;RW = 0;EN = 1;Port = dat;delayms(5);EN = 0;}void Clear_L(void) // 左半屏清屏{uchar i,j;CS1 = 1; CS2 = 0;LCD_WrCom_L(Page_Add + 0);LCD_WrCom_L(Col_Add + 0);for(j = 0; j < 8; j++)LCD_WrCom_L(Page_Add + j);for(i = 0; i < 64; i++)LCD_WrDat_L(0x00);}void Clear_R(void) // 右半屏清屏{uchar i,j;CS1 = 0; CS2 = 1;LCD_WrCom_R(Page_Add + 0);LCD_WrCom_R(Col_Add + 0);for(j = 0; j < 8; j++)LCD_WrCom_R(Page_Add + j);for(i = 0; i < 64; i++)LCD_WrDat_R(0x00);}void Disp_HZ_L(uchar pag,uchar col,uchar n) // 显示左半屏汉字16*16 {uchar i = 0,j = 0;CS1 = 1; CS2 = 0;for(i = 0; i < 2; i++){LCD_WrCom_L(Page_Add + pag + i);LCD_WrCom_L(Col_Add + col);for(j = 0; j < 16; j++)LCD_WrDat_L(HZ_tab[n][16*i+j]);}}void Disp_SZ_L(uchar pag,uchar col,uchar n) // 显示左半屏数字8*16 {uchar i = 0,j = 0,k = 0;CS1 = 1; CS2 = 0;for(i = 0; i < 2; i++){LCD_WrCom_L(Page_Add + pag + i);LCD_WrCom_L(Col_Add + col);for(j = 0; j < 8; j++){LCD_WrDat_L(SZ_tab[n][8*i+j]);}}}void Disp_HZ_R(uchar pag,uchar col,uchar n) // 显示右半屏汉字16*16 {uchar i = 0,j = 0;CS1 = 0; CS2 = 1;for(i = 0; i < 2; i++){LCD_WrCom_R(Page_Add + pag + i);LCD_WrCom_R(Col_Add + col);for(j = 0; j < 16; j++)LCD_WrDat_R(HZ_tab[n][16*i+j]);}}void Disp_SZ_R(uchar pag,uchar col,uchar n) // 显示右半屏数字8*16 {uchar i = 0,j = 0;CS1 = 0; CS2 = 1;for(i = 0; i < 2; i++){LCD_WrCom_R(Page_Add + pag + i);LCD_WrCom_R(Col_Add + col);for(j = 0; j < 8; j++){LCD_WrDat_R(SZ_tab[n][8*i+j]);}}}void TimerInit(void) //定时器初始化函数{TMOD = 0x02; //设置定时器0为工作模式2TH0 = 0x47; //装初值TL0 = 0x47; //设定时间为0.2msEA = 1;ET0 = 1;TR0 = 1; //启动定时器0}void LCD_Init(void) // LCD初始化子程序{delayms(10);LCD_WrCom_L(Disp_Off); LCD_WrCom_R(Disp_Off);LCD_WrCom_L(Page_Add + 0); LCD_WrCom_R(Page_Add + 0);LCD_WrCom_L(Start_Line + 0); LCD_WrCom_R(Start_Line + 0);LCD_WrCom_L(Col_Add + 0); LCD_WrCom_R(Col_Add + 0);LCD_WrCom_L(Disp_On); LCD_WrCom_R(Disp_On); }void main(void){LCD_Init();TimerInit();Clear_L();Clear_R();while(1){sec = t%60; //秒钟分离min = (t/60)%60; //分钟分离hour = (t/3600)%60; //时钟分离a = sec%10; //秒钟个位分离b = (sec/10)%10; //秒钟十位分离c = min%10; //分钟个位分离d = (min/10)%10; //分钟十位分离e = hour%10; //时钟个位分离f = (hour/10)%10; //时钟十位分?Disp_HZ_L(0,32,0); // 第0页,第16列,第0个字Disp_HZ_L(0,48,1);Disp_HZ_R(0,0,2);Disp_HZ_R(0,16,3);Disp_SZ_L(2,24,2);Disp_SZ_L(2,32,0);Disp_SZ_L(2,40,1);Disp_SZ_L(2,48,4);Disp_SZ_L(2,56,10);Disp_SZ_R(2,0,0);Disp_SZ_R(2,8,6);Disp_SZ_R(2,16,10);Disp_SZ_R(2,24,2);Disp_SZ_R(2,32,7);Disp_SZ_L(4,32,f);Disp_SZ_L(4,40,e);Disp_SZ_L(4,48,11);Disp_SZ_L(4,56,d);Disp_SZ_R(4,0,c);Disp_SZ_R(4,8,11);Disp_SZ_R(4,16,b);Disp_SZ_R(4,24,a);Disp_HZ_L(6,0,4);Disp_HZ_L(6,16,5);Disp_HZ_L(6,32,6);Disp_HZ_L(6,48,7);Disp_SZ_R(6,0,11);}}void timer0(void) interrupt 1{uint i;i++;if(i == 5000) //1s时间到{t++; //秒表计时开始i = 0;}}。
12864程序(无字库)
uchar border_inf[8] = {0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80};unsigned char dan[]={0x00,0x00,0xF8,0x28,0x29,0x2E,0x2A,0xF8,0x28,0x2C,0x2B,0x2A,0xF8,0x00,0x00,0x00,0x08,0x08,0x0B,0x09,0x09,0x09,0x09,0xFF,0x09,0x09,0x09,0x09,0x0B,0x08,0x08,0x00,};unsigned char pian[]={0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x18,0x10,0x00,0x80,0x40,0x30,0x0F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x00,0x00,0x00,0x00,};unsigned char ji[]={0x08,0x08,0xC8,0xFF,0x48,0x88,0x08,0x00,0xFE,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x04,0x03,0x00,0xFF,0x00,0x41,0x30,0x0C,0x03,0x00,0x00,0x00,0x3F,0x40,0x78,0x00,};unsigned char kai[]={0x40,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0x00,0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,};unsigned char fa[]={0x00,0x10,0x3E,0x10,0x10,0xF0,0x9F,0x90,0x90,0x92,0x94,0x1C,0x10,0x10,0x10,0x00,0x40,0x20,0x10,0x88,0x87,0x41,0x46,0x28,0x10,0x28,0x27,0x40,0xC0,0x40,0x00,0x00,};unsigned char ban[]={0x10,0x10,0xD0,0xFF,0x50,0x90,0x00,0xFE,0x62,0xA2,0x22,0x21,0xA1,0x61,0x00,0x00,0x04,0x03,0x00,0x7F,0x00,0x11,0x0E,0x41,0x20,0x11,0x0A,0x0E,0x31,0x60,0x20,0x00,};unsigned char w[]={0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,};uchar corp_pic[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xF8,0xF8,0x08,0x00, 0x00,0x00,0xF8,0xF8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x8C,0xBC, 0xF8,0xF8,0xA0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xC0,0xC0,0xC0,0xC0,0x80,0x00, 0x00,0x00,0x00,0x00,0x08,0x38,0xF0,0xE0,0x40,0x00,0x00,0x00,0xC0,0xF8,0xFC,0xBC, 0x88,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xC0,0x60,0x60,0x40,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x08,0x38,0xF0,0xF0,0xE0,0x00,0x00,0x20,0x20,0x20,0x20,0xE0, 0xE0,0xE0,0x20,0x20,0x20,0x20,0xF0,0xF0,0xF0,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xFF,0xFF,0xFF,0x00,0x00, 0x00,0x00,0xFF,0xFF,0xFF,0x40,0x60,0x20,0x30,0x18,0x1C,0x0E,0x0E,0x04,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xF8,0xF8,0x10,0x10,0x10,0x10,0x10, 0x10,0x10,0x10,0x10,0x10,0x10,0x18,0xFC,0xFC,0x18,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x02,0x0E,0x3C,0x78,0x70,0x00,0xF0,0xFE,0x1E,0x1C,0x0F,0xFF,0xFF,0x7C,0x08,0x18,0x38,0xE8,0xE8,0xC8,0x08,0x08,0x08,0xFC,0xFC,0x0C,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x20,0x20,0x20,0x20,0x30,0xF0,0xF0,0x20,0x00,0x40,0x40,0x40,0x40,0xFF, 0xFF,0xFF,0x40,0x60,0x20,0x60,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xFF,0xFF,0xFF,0x00,0x00, 0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xDF,0xCF,0xC4,0x84,0x04,0x04,0xFC, 0xFC,0xFC,0x04,0x04,0x04,0x44,0xC4,0x8F,0x8F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x40,0xC0,0xE0,0xF8,0xFF,0x0F,0x02,0x02,0xC2,0xFF,0xFF,0x1F,0x02,0x02, 0x02,0x3A,0xFA,0xF2,0x02,0x02,0x02,0xFE,0xFF,0xFF,0x02,0x02,0x03,0x03,0x02,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, 0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x0F,0x3F,0x7C,0xE0,0xE0,0xF8,0x38,0x00,0x00, 0x00,0x00,0x02,0x06,0x06,0x07,0x03,0x01,0x01,0x00,0x00,0x3F,0x3F,0x3F,0x00,0x00,0x00,0x00,0x1F,0x1F,0x3F,0x30,0x30,0x30,0x30,0x30,0x30,0x38,0x3F,0x1F,0x18,0x00,0x00,0x00,0x20,0x20,0x30,0x18,0x0C,0x0E,0x07,0x03,0x11,0x10,0x10,0x30,0x70,0x7F, 0x7F,0x3F,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x0F,0x3E,0x3E,0x08,0x00,0x00,0x00, 0x00,0x00,0x00,0x1C,0x3F,0x3F,0x30,0x00,0x00,0x01,0x03,0x03,0x03,0x02,0x02,0x02, 0x02,0x12,0x12,0x12,0x32,0x72,0x72,0x7F,0x3F,0x07,0x02,0x03,0x01,0x01,0x00,0x00, 0x00,0x00,0x04,0x0E,0x0F,0x03,0x01,0x01,0x01,0x03,0x06,0x0C,0x0C,0x18,0x18,0x1B, 0x1B,0x19,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x18,0x19,0x19,0x19,0x08,0x08, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xFC,0x3C,0x18,0x08,0x00,0x00,0x00, 0xFC,0xFC,0xF8,0x08,0x00,0x00,0x00,0x80,0xC0,0xE0,0xE0,0x60,0x40,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xC0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xC0, 0xC0,0xC0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xC0,0xE0,0xE0,0x40,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xF0,0xF0,0x70,0x30,0x00, 0x00,0x00,0x18,0xF8,0xE8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xF8,0xF8,0xF0,0x00,0x00,0x00,0x00, 0x00,0x00,0x20,0x30,0x18,0x0C,0x07,0xFF,0xFF,0xFF,0x41,0x40,0x40,0x60,0x20,0x30, 0x17,0xFF,0xFF,0x0C,0x06,0x06,0x03,0x03,0x01,0x00,0x00,0x00,0xF8,0xF8,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, 0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0x78,0x1E,0x0F,0x07,0x01,0x00,0x80,0xC0, 0xC0,0x80,0x80,0x00,0x03,0x0F,0x1E,0x78,0xF0,0xE0,0xC0,0x80,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x04,0x04,0x04,0x04,0xC4,0xC4,0x84,0x84,0x84,0x84,0x84,0x84,0x84, 0x84,0xC4,0xC4,0x86,0x06,0x06,0x04,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x47,0x47,0x47,0x40,0x40,0x40,0x40,0x40,0xFC, 0xFC,0xFF,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x63,0x63,0x41,0x00, 0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF, 0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, 0x00,0x00,0x04,0x06,0x03,0x01,0x01,0x00,0x00,0x00,0xC0,0xE0,0x78,0x3E,0x1F,0x07, 0x03,0x00,0x00,0x20,0xE0,0xC0,0x80,0x00,0x00,0x01,0x03,0x03,0x03,0x01,0x01,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x40,0x40,0x40,0x40,0x40,0x40,0x40, 0x40,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0x1F,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x07, 0x07,0x07,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x1C,0x1E,0x1F,0x1B,0x18,0x18,0x08,0x08,0x08, 0x08,0x08,0x08,0x08,0x08,0x09,0x0F,0x1F,0x7E,0x7C,0x30,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x01,0x01,0x01,0x00,0x10,0x10,0x30,0x78,0x7F,0x3F,0x0F,0x00,0x00,0x00,0x00 };uchar corp_pic1[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x70,0xFC,0xFC,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xF0,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF0,0xF0,0xC0,0x80,0xE0,0xFF,0xFF,0xFF,0xFF,0x78,0x78,0xF8,0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF8,0xF8,0xF8,0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x06,0x3F,0x3F,0x9C,0x9C,0x3E,0x3C,0x38,0xF8,0xFC,0xFE,0xFE,0xFE,0xFE,0xFC,0xC0,0x80,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x7E,0xFF,0xE1,0x00,0xC0,0xF8,0xFC,0xFC,0xE4,0xE2,0xC2,0xC2,0xE1,0xA1,0x33,0xF3,0xF3,0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x3B,0x38,0x38,0x1E,0x9F,0x87,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0xC0,0xFF,0xFF,0xFF,0xFF,0xFB,0xF9,0xF8,0xF8,0xF8,0x78,0x78,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF8,0xFC,0xFF,0xFF,0x7F,0x3F,0x3F,0x1F,0x8F,0x8F,0xC3,0xC3,0xE3,0xE1,0xE1,0x31,0x31,0x73,0xE3,0xE3,0x7F,0x3F,0x00,0x00,0x00,0x00,0x00,0x10,0x78,0xF8,0xF0,0xF0,0xF0,0xFF,0xFF,0xFF,0xDF,0xFF,0xBF,0xB3,0xB0,0x99,0x9B,0x9F,0x9F,0x9F,0x9E,0x86,0x81,0x81,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x70,0x70,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0xF8,0xF8,0xF8,0xFF,0xBF,0x3F,0x3D,0xFC,0xFC,0xFC,0xFC,0x7F,0x1F,0x1F,0x1F,0x1E,0x0F,0x0E,0x0E,0x1E,0x1F,0x0E,0x04,0x00,0x00,0x00,0x00,0x00,0x81,0x87,0xC7,0xE7,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x1F,0x01,0x70,0xF0,0xF0,0xF0,0xF0,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x67,0xE3,0xE0,0xE0,0xE0,0xE1,0xE3,0xF3,0xF8,0xFE,0xFF,0xFB,0xF0,0x70,0x70,0x70,0x70,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x07,0x07,0x07,0x07,0x07,0x0F,0x0F,0x07,0x07,0x07,0x0F,0x0F,0x0F,0x0F,0x1F,0x1F,0x0F,0x0F,0x0F,0x07,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x0E,0x1E,0x1E,0x1E,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x07,0x07,0x07,0x07,0x0F,0x0F,0x1E,0x1E,0x3C,0x3C,0x18,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x07,0x07,0x07,0x07,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x1C,0x3C,0x3C,0x3C,0x3C,0x1F,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};程序如下:*******************************************************************************主程序:#include <reg52.h>#include <LCD_12864.h>main() //主程序{unsigned char i=0;while(1){init_lcd();display_imge1();delay(30000);Msg(0);delay(30000);display_imge2();delay(30000);Disp_H_Line();delay(10000);Disp_V_Line();delay(10000);Msg(1);delay(30000);}}驱动程序//**********************LCD——12864显示程序**************// #include <reg52.h>#include <string.h>#include <math.h>#include <LCD_12864.h>#include <LCD_12864_data.h>#define Disp_On 0x3f //开显示#define Disp_Off 0x3e //关显示#define Col_Add 0x40 //#define Page_Add 0xb8 //页起始地址#define Start_Line 0xc0 //行起始地址#define Lcd_Bus P0 // MCU P0<------> LCMsbit Di =P2^0; //Data or Instrument Select RSsbit RW =P2^1; //Write or Read R/Wsbit Enable =P2^2; //6800 mode Enable single Esbit Mcs =P2^3; //Master chip enable CS1sbit Scs =P2^4; //Slave chip enable CS2sbit Lcd_Rst=P2^5; //Lcm reset RSTvoid delay(unsigned int t) //延时子程序{unsigned int i,j;for(i=0;i<t;i++)for(j=0;j<10;j++);}void write_com(unsigned char cmdcode) //写指令{Di=0;RW=0;Lcd_Bus=cmdcode;delay(0);Enable=1;delay(0);Enable=0;}void write_data(unsigned char Dispdata) //写数据{Di=1;RW=0;Lcd_Bus=Dispdata;delay(0);Enable=1;delay(0);Enable=0;}void frame() //{unsigned char i;Mcs=1;Scs=1;write_com(Page_Add+0);write_com(Col_Add+0);for(i=0;i<64;i++) write_data(0x01);write_com(Page_Add+7);write_com(Col_Add+0);for(i=0;i<64;i++) write_data(0x80);for(i=0;i<8;i++){Mcs=1;Scs=1;write_com(Page_Add+i);write_com(Col_Add+63);write_data(0xff);Mcs=1;Scs=1;write_com(Page_Add+i);write_com(Col_Add+0);write_data(0xff);}}void Clr_Scr(){unsigned char j,k;Mcs=1;Scs=1;write_com(Page_Add+0);write_com(Col_Add+0);for(k=0;k<8;k++){write_com(Page_Add+k);for(j=0;j<64;j++)write_data(0x00);}}void Disp_Img(unsigned char code *img) //显示图片{unsigned char j,k;Clr_Scr();for(k=0;k<8;k++){Mcs=1;Scs=0;delay(10);write_com(Page_Add+k);write_com(Col_Add+0);for(j=0;j<64;j++) write_data(img[k*128+j]);Mcs=0;Scs=1; delay(10);write_com(Page_Add+k);write_com(Col_Add+0);for(j=64;j<128;j++) write_data(img[k*128+j]);}}void Disp_H_Line() //显示行线{unsigned char i,j;Mcs=1;Scs=1;write_com(Disp_On);write_com(Page_Add);write_com(Start_Line);write_com(Col_Add);for(j=0;j<8;j++){write_com(Page_Add+j);write_com(Col_Add+0);// write_com(Start_Line+0);for(i=0;i<64;i++)write_data(0x55);}}void Disp_V_Line() //显示列线unsigned char i,j;write_com(Disp_On);write_com(Page_Add);write_com(Start_Line);write_com(Col_Add);for(j=0;j<8;j++){write_com(Page_Add+j);write_com(Col_Add+0);write_com(Start_Line+0);for(i=0;i<32;i++){write_data(0x00);write_data(0xff);}}}void hz_disp16(unsigned char pag,unsigned char col, unsigned char code *hzk) //行列显示{unsigned char j=0,i=0;for(j=0;j<2;j++){write_com(Page_Add+pag+j); //第3、4行write_com(Col_Add+col); //列选for(i=0;i<16;i++) write_data(hzk[16*j+i]);}}void init_lcd() //显示初始化{Lcd_Rst=0;delay(100);Lcd_Rst=1;delay(100);Mcs=1;Scs=1;delay(100);write_com(Disp_Off);write_com(Page_Add+0);write_com(Start_Line+0);write_com(Col_Add+0);write_com(Disp_On);}void Msg(int flg)Clr_Scr();frame();if(flg==0){ //显示“延安大学”Mcs=1;Scs=0;hz_disp16(3,32,yan);delay(4000);hz_disp16(3,48,an);delay(4000);Mcs=0;Scs=1;hz_disp16(3,0,da);delay(4000);hz_disp16(3,16,xue);delay(4000);}else if(flg==1){ //显示“测试完毕”Mcs=1;Scs=0;hz_disp16(3,32,ce);hz_disp16(3,48,shi);Mcs=0;Scs=1;hz_disp16(3,0,wan);hz_disp16(3,16,bi);}}void display_imge1(){Disp_Img(FirstPage);}void display_imge2(){Disp_Img(SecondPage);}字模数据#include <reg52.h>char code yan[]={0x02,0x22,0x72,0x2E,0xE2,0x00,0x04,0xE4,0x04,0x04,0xFC,0x42,0x42,0x42,0x00,0x00,0x40,0x23,0x14,0x08,0x17,0x20,0x20,0x47,0x44,0x44,0x47,0x44,0x44,0x44,0x44,0x00/*"延",0*/};char code an[]={0x80,0x90,0x8C,0x84,0x84,0xF4,0xA5,0x86,0x84,0x84,0x84,0x84,0x94,0x8C,0x84,0x00,0x80,0x80,0x80,0x40,0x47,0x28,0x28,0x10,0x28,0x24,0x43,0xC0,0x40,0x00,0x00,0x00/*"安",1*/};char code da[]={0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x7F,0xA0,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x01,0x06,0x08,0x30,0x60,0xC0,0x40,0x00/*"大",2*/};char code xue[]={0x40,0x30,0x10,0x12,0x5C,0x54,0x50,0x51,0x5E,0xD4,0x50,0x18,0x57,0x32,0x10,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x42,0x82,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x00/*"学",3*/};char code ce[]={0x08,0x31,0x86,0x60,0x00,0xFE,0x02,0xF2,0x02,0xFE,0x00,0xF8,0x00,0x00,0xFF,0x00,0x04,0xFC,0x03,0x00,0x80,0x47,0x30,0x0F,0x10,0x67,0x00,0x07,0x40,0x80,0x7F,0x00,/*"测",0*/};char code shi[]={0x40,0x42,0xDC,0x08,0x00,0x90,0x90,0x90,0x90,0x90,0xFF,0x10,0x12,0x1C,0x10,0x00,0x00,0x00,0x7F,0x20,0x10,0x20,0x20,0x1F,0x10,0x10,0x01,0x06,0x18,0x20,0x78,0x00,/*"试",0*/};char code wan[]={0x00,0x90,0x8C,0xA4,0xA4,0xA4,0xA5,0xA6,0xA4,0xA4,0xA4,0xA4,0x94,0x8C,0x04,0x00, 0x00,0x80,0x40,0x20,0x18,0x07,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x70,0x00,0x00,/*"完",0*/};char code bi[]={0x00,0x00,0xFF,0x88,0x48,0x28,0x08,0x80,0x7F,0x88,0x88,0x88,0x84,0x84,0xE0,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,/*"毕",0*/};unsigned char code FirstPage[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x70,0xFC,0xFC,0x7C,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xC0,0xF0,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF0,0xF0,0xC0,0x80,0xE0,0xFF,0xFF,0xFF,0xFF,0x78,0x78,0xF8,0xF0,0xE0,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF8,0xF8,0xF8,0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x06,0x3F,0x3F,0x9C,0x9C,0x3E,0x3C,0x38,0xF8,0xFC,0xFE,0xFE,0xFE,0xFE,0xFC,0xC0,0x80,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x7E,0xFF,0xE1,0x00,0xC0,0xF8,0xFC,0xFC,0xE4, 0xE2,0xC2,0xC2,0xE1,0xA1,0x33,0xF3,0xF3,0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x3B,0x38,0x38,0x1E,0x9F,0x87,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0xC0,0xFF,0xFF,0xFF,0xFF,0xFB,0xF9,0xF8,0xF8,0xF8,0x78,0x78,0x30,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF8,0xFC,0xFF,0xFF,0x7F,0x3F,0x3F,0x1F,0x8F,0x8F,0xC3,0xC3,0xE3,0xE1,0xE1,0x31,0x31,0x73,0xE3,0xE3,0x7F,0x3F,0x00,0x00,0x00, 0x00,0x00,0x10,0x78,0xF8,0xF0,0xF0,0xF0,0xFF,0xFF,0xFF,0xDF,0xFF,0xBF,0xB3,0xB0, 0x99,0x9B,0x9F,0x9F,0x9F,0x9E,0x86,0x81,0x81,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x70,0x70,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0xF8,0xF8,0xF8,0xFF,0xBF,0x3F,0x3D,0xFC,0xFC,0xFC,0xFC,0x7F,0x1F,0x1F,0x1F,0x1E, 0x0F,0x0E,0x0E,0x1E,0x1F,0x0E,0x04,0x00,0x00,0x00,0x00,0x00,0x81,0x87,0xC7,0xE7, 0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x1F,0x01,0x70,0xF0,0xF0,0xF0,0xF0,0xE0,0xC0,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x67,0xE3,0xE0,0xE0,0xE0,0xE1,0xE3, 0xF3,0xF8,0xFE,0xFF,0xFB,0xF0,0x70,0x70,0x70,0x70,0x60,0x00,0x00,0x00,0x00,0x00, 0x00,0x06,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x07,0x07,0x07,0x07,0x07,0x0F,0x0F,0x07,0x07,0x07,0x0F,0x0F,0x0F,0x0F,0x1F,0x1F,0x0F,0x0F,0x0F,0x07,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x0E,0x1E,0x1E,0x1E,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x07,0x07,0x07,0x07,0x0F,0x0F,0x1E,0x1E,0x3C,0x3C,0x18,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x07,0x07,0x07,0x07,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x1C,0x3C,0x3C,0x3C,0x3C,0x1F,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"C:\Documents and Settings\Administrator\桌面\延安大学字.bmp",0*/};unsigned char code SecondPage[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0x80, 0x00,0x00,0xC0,0xC0,0xC0,0x80,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0xC1,0xF1,0xFD,0xFF,0xDF,0xC7,0xC0,0x12,0xF3,0xF3,0xF3,0x03,0xFF,0xFF, 0xFF,0x41,0x41,0x41,0x41,0x00,0x00,0x00,0x00,0x00,0x1E,0x1E,0x1E,0x02,0x02,0x02, 0xC2,0xF2,0xF2,0x73,0x23,0x03,0x02,0x02,0x02,0x02,0x02,0x3E,0x3E,0x3E,0x00,0x00, 0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xFF,0xFF,0xFF,0xFF,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x78,0x78,0x78,0x78,0x8B,0x8B,0x8B, 0x8A,0x88,0x89,0x8B,0x89,0x89,0x8C,0x8F,0x8F,0x8F,0x89,0x78,0x78,0x78,0x78,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x1C,0xBC,0xF8,0xFE,0xFF,0x9F,0x81,0x20,0x3F,0x3F,0x3F,0x20,0x3F,0x3F, 0x3F,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x03,0x03,0x03,0x03,0x13,0x1F,0x3F,0x3F,0xB7,0xF3,0xE3,0xE3,0xF3,0xFF,0xFF,0x9F,0x87,0x03,0x03,0x03,0x03,0x03,0x00, 0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0xF0,0xF8,0x7E,0x3F,0x0F,0x0F,0x1F,0x7C,0xF8, 0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10, 0x10,0x10,0x10,0xFC,0xFE,0xFE,0x17,0x13,0x13,0x11,0x11,0x10,0x10,0x10,0x10,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0xC0,0xC0,0xC0,0xC0,0x80, 0x00,0x06,0x07,0x07,0x03,0x01,0x81,0x81,0x83,0x83,0x83,0x83,0xC6,0xC6,0xC6,0x86, 0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x02,0x0E,0xCE,0xC6,0x07,0xC7, 0x83,0x03,0x03,0x01,0x01,0x80,0x81,0x01,0x03,0x03,0x07,0x87,0x87,0x02,0x00,0x00,0x81,0x81,0x03,0x07,0x07,0x03,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xFF,0xFF,0x8D,0x8D,0x8D,0x8C,0xFC,0xFC,0x8C,0x8C,0x80,0x80,0x00,0x80,0x80,0x80,0xFF,0xFF,0x99,0x99,0x99,0x99,0xF8,0xF8,0x98,0x98,0x80,0x80,0x00,0x33,0x33,0xFF,0xFF,0x33,0x00,0x16,0x36,0xA6,0xFF,0xFF,0xC6,0x66,0x37,0x16,0x00,0x00,0x00,0xFF,0xFF,0x18,0x18,0x18,0x00,0xFF,0xFF,0x30,0x18,0x1C,0x0C,0x00,0x00,0x00,0xA1,0xA1,0xAA,0xEA,0xFF,0xBF,0xAA,0xAA,0xFF,0xFF,0xAA,0xAA, 0xA1,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x19,0x19,0x0D,0x0D,0x07,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x07,0x05,0x0D,0x19,0x11,0x01,0x00,0x0C,0x0C,0x07,0x07,0x06,0x00,0x06,0x03,0x19,0x1F,0x0F,0x01,0x03,0x06,0x04,0x00,0x00,0x00,0x1F,0x1F,0x0C,0x06,0x06,0x00,0x0F,0x1F,0x18,0x18,0x18,0x1E,0x0C,0x00,0x00,0x00,0x10,0x10,0x1B,0x1B,0x0C,0x06,0x06,0x0C,0x8B,0x9B,0x18,0x10,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0xC0,0xC0,0x00,0x00,0x00,0x80,0xC0,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0, 0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x18,0x18,0xF8,0xF9,0x03,0x00,0x01,0xF1,0xF1,0x31,0x31,0x31,0x3F,0x3F,0x00,0x00,0x00,0x30,0x18,0x3C,0x36,0xF3,0xF1,0x30,0x30,0x33,0xF7,0xFE,0x1C,0x38,0x10,0x00,0x00,0xFF,0xFF,0xD8,0xDF,0xDF,0x18,0x7F,0x7F,0xCB,0xFF,0xFF,0xCB,0x7F,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x1F,0x0C,0x06,0x00,0x0F,0x1F,0x18,0x18,0x18,0x18,0x1C,0x1C,0x00,0x00,0x08,0x18,0x0C,0x06,0x03,0x01,0x00,0x18,0x18,0x0F,0x07,0x00,0x00,0x00,0x00,0x18,0x0F,0x03,0x00,0x1F,0x1F,0x06,0x06,0x07,0x07,0x06,0x1F,0x1F,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,/*"C:\Documents and Settings\Administrator\桌面\乒乓球记分牌.bmp",0*/};/×××××××××××××××××××××××××××××××××××××××库函数.h××××××××××××××××××××××××××××××××××××××/ void delay(unsigned int t);。
12864显示汉字,图型,任意点,任意直线程序(绝对能用)
#include<stdio.h>#include<reg52.h>#include<math.h>#include<intrins.h>sbit RS=P0^0;sbit RW=P0^1;sbit E=P0^2;sbit PSB=P0^3;sbit RES=P0^4;#define LCD12864_DatePort P2unsigned char lcd_x,lcd_y;unsigned char h[]={"aaaaaaaaaaaaaaaa"};unsigned char code image[1024]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xC0,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x01,0xFF,0xE0,0x00,0x00,0x00,0x1F,0xC1,0xC0,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x07,0xFF,0xF8,0x00,0x00,0x00,0xFF,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x1F,0xFF,0xFC,0x00,0x00,0x01,0xFF,0xFE,0x1F,0x80,0x00,0x00,0x00,0x00, 0x00,0x00,0x3F,0xFF,0xFF,0x00,0x00,0x07,0xFF,0xFF,0x9E,0xC0,0x00,0x00,0x00,0x00, 0x00,0x00,0x7F,0xFF,0xFF,0x80,0x00,0x0F,0xFF,0xFF,0xEC,0x60,0x00,0x00,0x00,0x00, 0x00,0x00,0xFF,0xFF,0xFF,0xC0,0x00,0x0F,0xFF,0xFF,0xE0,0x40,0x00,0x00,0x00,0x00, 0x00,0x01,0xFF,0x3E,0x3F,0xC0,0x00,0x1F,0xE3,0xE7,0xF0,0x80,0x00,0x00,0x00,0x00, 0x00,0x01,0xFE,0x1E,0x1F,0xE0,0x00,0x3F,0xE3,0xC3,0xF9,0x00,0x00,0x00,0x00,0x00, 0x00,0x03,0xFC,0x1C,0x1F,0xE0,0x00,0x3F,0xC1,0xC3,0xFC,0x00,0x00,0x00,0x00,0x00, 0x00,0x03,0xFC,0x6D,0x9F,0xF0,0x00,0x7F,0xC1,0x81,0xFE,0x00,0x00,0x00,0x00,0x00, 0x00,0x07,0xFC,0x6D,0x8F,0xF0,0x00,0x7F,0xCD,0xB1,0xFE,0x00,0x00,0x00,0x00,0x00, 0x00,0x07,0xFC,0x6D,0x9F,0xF0,0x00,0x7F,0xCF,0xB1,0xFF,0x00,0x00,0x00,0x00,0x00, 0x00,0x07,0xFC,0x1C,0x1F,0xF0,0x00,0xFF,0xC5,0xF3,0xFF,0x00,0x00,0x00,0x00,0x00, 0x00,0x07,0xFE,0x1E,0x1F,0xF8,0x00,0xFF,0xE3,0xC3,0xFF,0x00,0x00,0x00,0x00,0x00, 0x00,0x07,0xFF,0x3E,0x3F,0xF8,0x00,0xFF,0xE3,0xE7,0xFF,0x00,0x00,0x00,0x00,0x00, 0x00,0x0F,0xFF,0xF3,0xFF,0xF8,0x00,0xFF,0xFE,0x7F,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x0F,0xF8,0xC1,0xCF,0xFC,0x00,0xFF,0x9C,0x38,0xFF,0x80,0x00,0x00,0x00,0x00, 0x00,0x0F,0xE0,0x7F,0x83,0xFC,0x01,0xFE,0x0F,0xF0,0x3F,0x80,0x00,0x00,0x00,0x00, 0x00,0x1F,0xFF,0x00,0x3F,0xFC,0x01,0xFF,0xE0,0x07,0xFF,0x80,0x00,0x00,0x00,0x00, 0x00,0x1F,0xFF,0xFB,0xFF,0xFC,0x01,0xBF,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00, 0x00,0x1F,0xFF,0xFF,0xFF,0xFC,0x01,0xDF,0xFF,0xFF,0xFB,0x80,0x00,0x00,0x00,0x00, 0x00,0x3F,0xFF,0xFF,0xFF,0xFC,0x03,0xC7,0xFF,0xFF,0xE7,0x80,0x00,0x00,0x00,0x00, 0x00,0x7F,0xFF,0xFF,0xFF,0xFC,0x07,0xC1,0xFF,0xFF,0x8F,0xC0,0x00,0x00,0x00,0x00, 0x00,0xFF,0xFF,0xFF,0xFF,0xFE,0x0F,0xE0,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00, 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0xF8,0x00,0x00,0x7F,0xE0,0x00,0x00,0x00,0x00, 0x01,0xFC,0x7F,0xFF,0xFF,0x3F,0x1F,0x8E,0x00,0x00,0xE3,0xF0,0x00,0x00,0x00,0x00, 0x03,0xF8,0x7F,0xFF,0xFC,0x1F,0xBF,0x87,0xC8,0x1F,0x83,0xF0,0x00,0x00,0x00,0x00, 0x03,0xF8,0x7F,0xFF,0xE0,0x1F,0xFF,0x87,0xFF,0xFC,0x01,0xF8,0x00,0x00,0x00,0x00, 0x03,0xF8,0x7F,0x00,0x00,0x1F,0xFF,0x04,0xE0,0x00,0x01,0xF8,0x00,0x00,0x00,0x00, 0x07,0xF8,0x7F,0x00,0x00,0x0F,0xFF,0x04,0x60,0x00,0x01,0xF8,0x00,0x00,0x00,0x00, 0x07,0xF8,0x7F,0x00,0x00,0x0F,0xFF,0x0C,0x60,0x00,0x01,0xFC,0x00,0x00,0x00,0x00, 0x07,0xF8,0x7F,0x00,0x00,0x0F,0xFF,0x0C,0x60,0x00,0x01,0xFC,0x00,0x00,0x00,0x00, 0x07,0xF8,0x7F,0x00,0x00,0x0F,0xFF,0x06,0x60,0x00,0x01,0xFC,0x00,0x00,0x00,0x00, 0x07,0xB8,0x3E,0x00,0x00,0x19,0xF3,0x87,0xE0,0x00,0x01,0xBC,0x00,0x00,0x00,0x00, 0x07,0x18,0x00,0x00,0x00,0x18,0xE3,0x80,0x00,0x00,0x01,0x18,0x00,0x00,0x00,0x00, 0x00,0x1C,0x00,0x00,0x00,0x10,0x01,0x80,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00, 0x00,0x0C,0x00,0x00,0x00,0x30,0x01,0xC0,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00, 0x00,0x06,0x00,0x00,0x00,0x60,0x00,0xE0,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00, 0x00,0x03,0x00,0x00,0x00,0x40,0x00,0x70,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00, 0x00,0x03,0x80,0x00,0x00,0xC0,0x00,0x78,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, 0x00,0x0D,0xE0,0x00,0x03,0xB8,0x01,0x9C,0x00,0x00,0x3B,0x00,0x00,0x00,0x00,0x00, 0x00,0x18,0x78,0x00,0x0F,0x7C,0x03,0xCF,0x00,0x00,0xE7,0x80,0x00,0x00,0x00,0x00, 0x00,0x10,0x1C,0x00,0x3E,0xFC,0x03,0xF3,0xE0,0x03,0xDF,0x80,0x00,0x00,0x00,0x00, 0x00,0x1A,0x0B,0xC1,0xE3,0xF8,0x01,0xF8,0xFC,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00, 0x00,0x0F,0xF1,0x80,0xEF,0xE0,0x00,0x7F,0xF0,0x1F,0xFC,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};void delay_ms(unsigned char z) //延时{unsigned i,j;for(i=0;i<z;i++)for(j=0;j<110;j++);}void LCD12864_WriteCmd(unsigned int cmd) //写命令{RS=0;RW=0;E=0;LCD12864_DatePort=cmd;delay_ms(5);E=1;delay_ms(5);E=0;}void LCD12864_WriteDate(unsigned char dat) //写数据{RS=1;RW=0;E=0;LCD12864_DatePort=dat;delay_ms(5);E=1;delay_ms(5);E=0;}void LCD12864_Init(){PSB=1; //1并行,0串行LCD12864_WriteCmd(0x30); //基本指令操作//delay_ms(5);LCD12864_WriteCmd(0x0c); //显示开,关光标//delay_ms(5);LCD12864_WriteCmd(0x01); //清除led的显示内容//delay_ms(5);LCD12864_WriteCmd(0x06);}/*====================================================函数功能:清除GCROM的内容,如果不清除会出现花屏现象清除方法:向GCROM中写入0x00来清除内========================================================*/ void LCD12864_ClearGDRAM(){unsigned char i,j,k;lcd_x=0x80;lcd_y=0x80;LCD12864_WriteCmd(0x34);for(i=0;i<2;i++){for(j=0;j<32;j++){LCD12864_WriteCmd(lcd_y+j);LCD12864_WriteCmd(lcd_x);for(k=0;k<16;k++){LCD12864_WriteDate(0x00);}}lcd_x=0x88;}LCD12864_WriteCmd(0x36);LCD12864_WriteCmd(0x30);}/*================================================================ 函数功能:向12864中写入一幅图片函数参数:lcd_x为水平显示位置,lcd_y为垂直显示位置,函数将12864屏分成上下两屏写入,上半屏LCD_x=0x80,下半屏lcd_x=0x88=================================================================*/ void LCD12864_WriteImage(unsigned char *p){unsigned char i,j,k;lcd_x=0x80;lcd_y=0x80;LCD12864_WriteCmd(0x34);for(i=0;i<2;i++) //分为上下两屏{for(j=0;j<32;j++){LCD12864_WriteCmd(lcd_y+j);LCD12864_WriteCmd(lcd_x);for(k=0;k<16;k++) //写入显示数据{LCD12864_WriteDate(*p++);}}lcd_x=0x88;}LCD12864_WriteCmd(0x36);LCD12864_WriteCmd(0x30);}bit LCD12864_CheckBusy() //读忙碌状态{bit i;RS=0;RW=1;E=1;LCD12864_DatePort=0xff;delay_ms(1);i=(bit)(LCD12864_DatePort&0x80);E=0;return(i);}unsigned char LCD12864_ReadByte( void ){unsigned char ReturnValue ;LCD12864_CheckBusy() ;LCD12864_DatePort = 0xff ;RS=1;RW=1;E=0;E=1;ReturnValue =LCD12864_DatePort;E=0;return ReturnValue ;}void LCD12864_DrawPoint( unsigned char X, unsigned char Y, unsigned char Color ) {unsigned char Row , Tier , Tier_bit ;unsigned char ReadOldH, ReadOldL ;LCD12864_WriteCmd( 0x34 ) ;LCD12864_WriteCmd( 0x36 ) ;Tier = X >> 4 ;Tier_bit = X & 0x0f ;if( Y < 32 ){Row = Y ;}else{Row = Y - 32 ;Tier += 8 ;}LCD12864_WriteCmd( Row + 0x80 ) ;LCD12864_WriteCmd( Tier + 0x80 ) ;LCD12864_ReadByte();ReadOldH = LCD12864_ReadByte() ;ReadOldL = LCD12864_ReadByte() ;LCD12864_WriteCmd( Row + 0x80 ) ;LCD12864_WriteCmd( Tier + 0x80 ) ;if( Tier_bit < 8 ){switch( Color){case 0 : ReadOldH &=( ~( 0x01 << ( 7 - Tier_bit ))) ; break ;case 1 : ReadOldH |= ( 0x01 << ( 7 - Tier_bit )) ; break ;case 2 : ReadOldH ^= ( 0x01 << ( 7 - Tier_bit )) ; break ;default : break ;}LCD12864_WriteDate( ReadOldH ) ;LCD12864_WriteDate( ReadOldL ) ;}else{switch(Color){case 0 : ReadOldL &= (~( 0x01 << ( 15 - Tier_bit ))) ; break ;case 1 : ReadOldL |= ( 0x01 << ( 15 - Tier_bit )) ; break ;case 2 : ReadOldL ^= ( 0x01 << ( 15 - Tier_bit )) ; break ;default : break ;}LCD12864_WriteDate( ReadOldH ) ;LCD12864_WriteDate( ReadOldL ) ;}LCD12864_WriteCmd( 0x30 ) ;}void LCD12864_DrawLine_X( unsigned char X0, unsigned char X1, unsigned char Y, unsigned char Color ){ unsigned char Temp ;if( X0 > X1 ){Temp = X1 ;X1 = X0 ;X0 = Temp ;}for( ; X0 <= X1 ; X0++ )LCD12864_DrawPoint( X0, Y, Color ) ;}void LCD12864_DrawLine_Y( unsigned char X, unsigned char Y0, unsigned char Y1, unsigned char Color ){unsigned char Temp ;if( Y0 > Y1 ){Temp = Y1 ;Y1 = Y0 ;Y0 = Temp ;}for(; Y0 <= Y1 ; Y0++)LCD12864_DrawPoint( X, Y0, Color) ;}void LCD12864_DrawLine( unsigned char StartX, unsigned char StartY, unsigned char EndX, unsigned char EndY, unsigned char Color ){int t, distance; /*根据屏幕大小改变变量类型(如改为int型)*/int x = 0 , y = 0 , delta_x, delta_y ;char incx, incy ;delta_x = EndX - StartX ;delta_y = EndY - StartY ;if( delta_x > 0 ){incx = 1;}else if( delta_x == 0 ){LCD12864_DrawLine_Y( StartX, StartY, EndY, Color ) ;return ;}else{incx = -1 ;}if( delta_y > 0 ){incy = 1 ;}else if(delta_y == 0 ){LCD12864_DrawLine_X( StartX, EndX, StartY, Color ) ;return ;}else{incy = -1 ;}delta_x = abs( delta_x );//求绝对值delta_y = abs( delta_y );if( delta_x > delta_y ){distance = delta_x ;}else{distance = delta_y ;}LCD12864_DrawPoint( StartX, StartY, Color ) ;/* Draw Line*/for( t = 0 ; t <= distance+1 ; t++ ){LCD12864_DrawPoint( StartX, StartY, Color ) ;x += delta_x ;y += delta_y ;if( x > distance ){x -= distance ;StartX += incx ;}if( y > distance ){y -= distance ;StartY += incy ;}}}void LCD12864_DrawCross(){LCD12864_DrawLine_X( 0, 127 , 0, 1 ) ;LCD12864_DrawLine_X( 0, 127 , 7, 1 ) ;LCD12864_DrawLine_X( 0, 127 , 15, 1 ) ;LCD12864_DrawLine_X( 0, 127 , 23, 1 ) ;LCD12864_DrawLine_X( 0, 127 , 31, 1 ) ;LCD12864_DrawLine_X( 0, 127 , 39, 1 ) ;LCD12864_DrawLine_X( 0, 127 , 47, 1 ) ;LCD12864_DrawLine_X( 0, 127 , 55, 1 ) ;LCD12864_DrawLine_X( 0, 127 , 63, 1 ) ;LCD12864_DrawLine_Y( 0, 0 , 63, 1 ) ;LCD12864_DrawLine_Y( 15, 0 , 63, 1 ) ;LCD12864_DrawLine_Y( 31, 0 , 63, 1 ) ;LCD12864_DrawLine_Y( 47, 0 , 63, 1 ) ;LCD12864_DrawLine_Y( 63, 0 , 63, 1 ) ;LCD12864_DrawLine_Y( 79, 0 , 63, 1 ) ;LCD12864_DrawLine_Y( 95, 0 , 63, 1 ) ;LCD12864_DrawLine_Y( 111, 0 , 63, 1 ) ;LCD12864_DrawLine_Y( 127, 0 , 63, 1 ) ;}void LCD12864_Draw_ObliqueLine(){LCD12864_DrawLine( 0, 0, 127, 63, 1 ) ;LCD12864_DrawLine( 0, 63, 127, 0 , 1 ) ;LCD12864_DrawLine( 12, 0, 127, 63, 1 ) ;LCD12864_DrawLine( 52, 63, 127, 0 , 1 ) ;LCD12864_DrawLine( 32, 63, 98, 0, 1 ) ;LCD12864_DrawLine( 67, 0, 127, 63 , 1 ) ;}void LCD12864_DisplayOneChar(unsigned char X, unsigned char Y, unsigned char Data) {switch(Y){case 0:Y=0X80;break; //根据行数来选择相应地址case 1:Y=0X90;break;case 2:Y=0X88;break;case 3:Y=0X98;break;}LCD12864_WriteCmd( Y+X ); //这里不检测忙信号,发送地址码LCD12864_WriteDate(Data);}void LCD12864_DisplayListChar(unsigned char X, unsigned char Y, unsigned char *Data) {switch(Y){case 0:Y=0X80;break; //根据行数来选择相应地址case 1:Y=0X90;break;case 2:Y=0X88;break;case 3:Y=0X98;break;}LCD12864_WriteCmd( Y+X ); //这里不检测忙信号,发送地址码X = X*2;Y = 0;while( Data[Y] != 0 ) //若到达字串尾则退出{if (X <= 0x0F) //X坐标应小于0xF{LCD12864_WriteDate(Data[Y]);X++;Y++;}else break;}}void main(){LCD12864_Init();// write_com(0x1c);LCD12864_ClearGDRAM();//LCD12864_WriteImage(image);//LCD12864_Draw_ObliqueLine();LCD12864_DrawCross();//LCD12864_DisplayListChar(0,0,h);while(1);}。
LCD12864无字库 的运用(DOC)
二、LCD12864液晶的使用之无字库型(一)2011年02月15日星期二 14:07过年回家没办法联网,没办法上传LCD12864教程,还请大家见谅!现在就和大家一起LCD12864的使用!LCD12864分为两种,带字库和不带字库的,个人比较喜欢不带字库的,因为显示汉字的时候可以选择自己喜欢的字体,而带字库的液晶,只能显示GB2312的宋体,当然了,也可以显示其他的字体,不过不是液晶本身字库中带的了,而是用图片的形式显示。
本讲由于内容较多,故分两篇进行讲解,本人水平有限,难免有错误之处,还望大家批评改正!首先介绍下不带字库的LCD12864,现就以Proteus中的LCD12864为例进行讲解,Proteus 中AMPIRE128*64,其液晶驱动器为KS0108,我在网上搜了好就都没找到它的datasheet,不过我们可以找到类似的芯片的手册,它的控制逻辑和HD61202是类似的,我们可以网上下载它的datasheet进行参考。
与带字库液晶不同,此块液晶中含有两个液晶驱动器,一块驱动器控制64*64个点,左右显示,这就是为什么AMPIRE128*64引脚有CS1和CS2的原因。
学习液晶主要看的它的指令系统,再次先说明一下“页”的概念,此液晶有8页,一页有8行。
68/8=8;再介绍一下其他的几个重要指令:指令一、行设置命令由此可见其显示的其实行为0xC0,有规律的改变起始行号,可以实现滚屏的效果指令二、页(page)设置指令起始页为0xB8显示的RAM共64行,分为8页,每页有8行,刚才在上面已经讲过。
指令三、列(Y address)地址设置指令第一列为0x40一直到0x7F共64列,因为此液晶有128列,所以有两块驱动芯片驱动。
指令四、读状态指令Busy:为1内部忙,不能对液晶进行操作。
0--工作正常。
ON/OFF:1------显示关闭;0------显示打开RESET:1-----复位状态;0------正常。
LCD12864(不带字库)
LCD12864(不带字库)LCD12864(不带字库)其实看了本版的1602教程以后很容易就可以掌握12864了。
刚才看到有网友要12864教程,俺就把博客里以前练习的一个程序弄过来,算作参考吧。
不足之处请见谅。
这个程序浪费了我很多时间,因为我一直没有找到datasheet,12864的型号实在太多了。
为了这个程序,我在网上找了很多相关的例程,但大多都是C语言写的,可惜俺没学过C,用起来不顺手,遂将其转成汇编,但是转后,程序运行不正常,郁闷啊。
好不容易找个汇编的吧,又写得很乱,没有头绪,没有datasheet,看起来很费劲,最后终于找到一个相关的datasheet,这才完成这个程序。
总结一下:与其费力分析别人的程序,不如看datasheet自己写。
下面总结一下datasheet。
→↑← ONE→且看datasheet:12864点阵型LCD简介12864是一种图形点阵液晶显示器,它主要由行驱动器/列驱动器及128×64全点阵液晶显示器组成。
可完成图形显示,也可以显示8×4个(16×16点阵)汉字。
'700')this.width='700';if(this.height>'700')this.height='700';">在使用12864LCD前先必须了解以下功能器件才能进行编程。
12864内部功能器件及相关功能如下:1. 指令寄存器(IR) IR是用于寄存指令码,与数据寄存器数据相对应。
当D/I=0时,在E信号下降沿的作用下,指令码写入IR。
2.数据寄存器(DR) DR是用于寄存数据的,与指令寄存器寄存指令相对应。
当D/I=1时,在下降沿作用下,图形显示数据写入DR,或在E信号高电平作用下由DR读到DB7∽DB0数据总线。
12864显示程序
{
Wan=temp_data/10000+0x30 ;
temp_data=temp_data%10000;
Qian=temp_data/1000+0x30 ;
temp_data=temp_data%1000;
Delay5us();
ADXL345_SCL = 0;
Delay5us();
}
ADXL345_RecvACK();
}
/**************************************
{
ADXL345_SDA = 1;
ADXL345_SCL = 1;
Delay5us();
ADXL345_SDA = 0;
Delay5us();
}
void ADXL345_SendACK(bit ack)
{
ADXL345_SDA = ack;
ADXL345_SCL = 1;
Delay5us();
void ADXL345_Single_Write(uchar REG_Address,uchar REG_data)
{
ADXL345_Start();
ADXL345_SendByte(SlaveAddress);
ADXL345_SendByte(REG_Address);
#include<reg52.h>
#include<intrins.h>
#include<math.h>
#include<stdio.h>
12864多变量显示成功程序
#include <reg51.h>#define uchar unsigned char //宏定义#define uint unsigned int#define lcdbus P1sbit RS = P2^2;sbit RW =P2^1;sbit E = P2^0;sbit st=P3^2;sbit eoc=P3^4;sbit oe=P3^3;sbit A=P3^5;sbit B1=P3^6;sbit C=P3^7;void display(uchar);void busy();uchar table1[]={"0123456789.V"};void delay(uint z) //0.1MS 准确延时 z=1 {uint x,y;for (x=0;x<z;x++)for(y=0;y<11;y++);}void write_com(uchar xiezl) //写指令{busy();RS=0;RW=0;E=1;lcdbus=xiezl;delay(5);E=0;delay(5);}void busy() //查忙{ RS=0;RW=1;E=1;lcdbus=0xff;while((lcdbus&0x80)==0x80);E=0;}void write_data(uchar xiesj) //写数据{busy();RS=1;RW=0;E=1;lcdbus=xiesj;delay(5);E=0;delay(5);}void xianshi(uchar code *s) //用指针显示字符串{ //各种字符都用字符串显示出来方法简单 while(*s>0){write_data(*s);s++;delay(10);}}void xianshi2(uchar code *s) //用指针显示字符串{ //各种字符都用字符串显示出来方法简单 while(*s>0){write_data(*s);s++;delay(10);}}void lcdcsh() //液晶初始化{ delay(2000);write_com(0x30);delay(10);write_com(0x30);delay(5);write_com(0x0c); //开显示(无游标、不反白)delay(10);write_com(0x01); //清除显示,并且设定地址指针为00Hdelay(500);write_com(0x06); //指定在资料的读取及写入时,设定游标的移动方向及指定显示的移位delay(10);}void main(){ uchar adc;lcdcsh();while(1){ write_com(0x01);delay(5);write_com(0x81);xianshi("欢迎各校领导:");delay(5);write_com(0x90);xianshi("来创新实验室进行");delay(5);write_com(0x88);xianshi("工作指导!");delay(5);write_com(0x9a);xianshi("--创新实验室");delay(50000);write_com(0x01);delay(5);while(1){ A=1;B1=1;C=0;st=0;delay(5);st=1;delay(5);st=0;if(eoc==0);if(oe==0);adc=P0;delay(10);write_com(0x80);xianshi2("当前温度: 0.00V");display(adc);delay(5);write_com(0x90);xianshi2("当前时间: 10S");delay(5);write_com(0x88);xianshi2("前方距离: 110cm");delay(5);write_com(0x98);xianshi2("速度:10cm/s");delay(50000);}}}void display(uchar adc){ uint a,b,c;write_com(0x85);a=adc/51;write_data(table1[a]);delay(10);write_data(table1[10]) ;delay(10);b=((adc%51)*10)/51;if(adc%51>25)b=((adc%51)*10)/51+5;write_data(table1[b]);delay(10);c= ((adc%51)*10)%51*10/51;if(((adc%51)*10)%51>25)c=((adc%51)*10)%51*10/51+5;write_data(table1[c]);delay(10);}。
不带字库12864仿真
} //显示一个数字 void display_a_char(uchar lcd,uchar p ,uchar c,uchar b,uchar *m) {
uchar i; select_lcd(lcd); set_page(p); set_column(c);
for(i=0;i<8;i++) {
write_data(m[i+16*b]); } set_page(p+1); set_column(c); for(i=0;i<8;i++) {
0x00,0x00,0xFF,0x00,0x80,0x81,0x45,0x29,0x11,0x2F,0x41,0x41,0x81,0x81,0x80,0x00
};
uchar code yong[] =
{
0x00,0x00,0xFE,0x22,0x22,0x22,0x22,0xFE,0x22,0x22,0x22,0x22,0xFE,0x00,0x00,0x00,
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,
rd=1;cs=1;//停止 A/D 读取 return(i); }
uint temper(void)//ADC0804 读出的数据处理 {
uint i=0; uchar x; for(x=0;x<10;x++) { i=adc0804()+i; } i=i*2; return(i);
12864程序
include<reg52.h>#include <math.h>void lcd_init(void);void clr_lcd(void);void send_com(unsigned char cmd);void send_data(unsigned char dat);void chek_busy(void);void set_xy(unsigned char xpos,unsigned char ypos);void print(unsigned char x,unsigned char y,char* str);void printstr(unsigned char xpos,unsigned char ypos,unsigned charstr[],unsigned char k);unsigned char code buf[4] ={0xbb,0xb6,0xd3,0xad};//欢迎#define DATA P2#define CONTROL P0#define E 7 //并行的使能信号 sbit E = P0^7#define RW 6 //并行的读写信号 sbit RW = P0^6#define RS 5 //并行的指令数据选择信号 sbit RS = P0^5#define PSB 4 //并/串行接口选择 sbit PSB = P0^4#define RST 3 //复位低电平有效 sbit RST = P0^3#define SETB(x,y) (x|=(1<<y))#define CLRB(x,y) (x&=(~(1<<y)))#define CHKB(x,y) (x&(1<<y))/********************测忙碌**********************///测忙碌子程序//RS=0,RW=1,E=H,D0-D7=状态字/************************************************/void chek_busy(void){ unsigned char temp1;//状态信息(判断是否忙)CLRB(CONTROL,RS); // RS = 0;SETB(CONTROL,RW); // RW = 1;SETB(CONTROL,E); // E = 1;do{temp1 = DATA;DATA=0xFF;} while(temp1&0x80);SETB(CONTROL,E); // E = 1;DATA=0xFF;}/********************写命令**********************///写命令子程序///************************************************/void send_com(unsigned char cmd)/*写命令*/{chek_busy();CLRB(CONTROL,RS); //RS = 0;CLRB(CONTROL,RW); //RW = 0;DATA = cmd;SETB(CONTROL,E); //E = 1;CLRB(CONTROL,E); //E = 0;}/********************写数据**********************///写数据子程序///************************************************/void send_data(unsigned char dat){chek_busy();SETB(CONTROL,RS); //RS = 1;CLRB(CONTROL,RW); //RW = 0;DATA = dat;SETB(CONTROL,E); //E = 1;CLRB(CONTROL,E); //E = 0;}/********************初始化**********************///复位、通讯方式选择/************************************************/void lcd_init(void){SETB(CONTROL,RST);//复位RST=1SETB(CONTROL,PSB); //通讯方式为并口PSB = 1//send_com(0x34);//34H--扩充指令操作send_com(0x30);//功能设置,一次送8位数据,基本指令集send_com(0x0C);//0000,1100 整体显示,游标off,游标位置offsend_com(0x01);//0000,0001 清DDRAMsend_com(0x02);//0000,0010 DDRAM地址归位send_com(0x80);//1000,0000 设定DDRAM 7位地址000,0000到地址计数器AC }/*******************************************************************/ // 设置显示位置 xpos(1~16),tpos(1~4)/*******************************************************************/ void set_xy(unsigned char xpos,unsigned char ypos){switch(ypos){case 1:send_com(0X80|xpos);break;case 2:send_com(0X90|xpos);break;case 3:send_com(0X88|xpos);break;case 4:send_com(0X98|xpos);break;default:break;}}/*******************************************************************/ // 在指定位置显示字符串/*******************************************************************/ void print(unsigned char x,unsigned char y,char* str){unsigned char lcd_temp;set_xy(x,y);lcd_temp=*str;while(lcd_temp != 0x00){send_data(lcd_temp);lcd_temp=*(++str);}}/********************写字符串******************///写字符串子程序//xpos1取0~7共八列,ypos1取0~3共四行。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
功能:
向
LCD
写入数据
参数:
WDLCD
待写入的字符数据
select
用于选择
LCD
屏的左右
,1
选择左屏,
2
选********************************************/
void WriteDataLCD(unsigned char WDLCD,unsigned char select)
{
switch(select)
{
case 1:{LCD_CSA=1;LCD_CSB=0;break;}//
左
函数声明
*****************************************/
void ReadStatusLCD(unsigned char select);//
从
LCD
读出忙标志位
unsigned char ReadDataLCD(unsigned char select);//
向指定行列
写数据
void LcmPutDots(unsigned char Column,unsigned char Page, unsigned char DotByte );//
显示点
void whiteword(unsigned char Column,unsigned char Page, const unsigned char puts[][16] );//
void set_XY(unsigned char Column,unsigned char Page);//
设置数据写入或读出的地址,通过页
号和列数可以唯一确定一个地址
void
xy_Write(unsigned char Column,unsigned char Page,unsigned char dataW);//
#endif
12864.c
/****************************************************
LCD12864
点阵液晶屏,
通过
I/O
口直接控制,采用模拟时序控制
****************************************************/
#include"12864.h"
#include<math.h>
/***********************************************************
功能:从
LCD
读取状态位
变量:
select
用于选择
LCD
左
case 2:{LCD_CSA=0;LCD_CSB=1;break;}//
右
default: break;
}
LCD_RW=1;LCD_RS=1;LCD_E = 1;//
操作允许脉冲信号,高电平读出
口模拟点阵液晶所需时序
点阵液晶控制端口定义,需根据硬件适当改变
****************************************/
sbit LCD_RS = P2^0;//
控制端口定义
sbit LCD_RW = P2^1;
sbit LCD_E = P2^2;
{
case 1:{LCD_CSA=1;LCD_CSB=0;break;}//
左
case 2:{LCD_CSA=0;LCD_CSB=1;break;}//
右
default: break;
}
//_nop_();
//
若晶振速度高,可在此作延时处理
dataR = LCD_Data;
LCD_E= 0;
return dataR;
}
/***********************************************************
case 2:{LCD_CSA=0;LCD_CSB=1;break;}//
右
default: break;
}
ReadStatusLCD(select);//
检测忙标志
LCD_RS = 1;LCD_RW = 0;
显
示
16
×
16
点阵的编码
void WhiteWord_Com(unsigned char Column,unsigned char Page,unsigned char C_num,
LCD_Data = WDLCD;
LCD_E = 1;
//_nop_();
//
若晶振速度高,可在此作延时处理
LCD_E = 0; //
下降沿写入数据
//_nop_();
//
若晶振速度高,可在此作延时处理
}
/***********************************************************
功能:向
LCD
写入命令
参数:
WDLCD
待写入的字符数据
BusyC
是否要检查忙标志位选择标志,
while(LCD_Data&0x80);//
最高位为忙标志
,
检测忙信号状态
LCD_E=0;
//_nop_();
//
若晶振速度高,可在此作延时处理
}
/***********************************************************
1
为进行,
0
为不检测
select
用于选择
LCD
屏的左右
,1
选择左屏,
2
选择右屏
***********************************************************/
void WriteCommandLCD(unsigned char WCLCD , unsigned char BusyC,unsigned char select)
{
if(BusyC)
ReadStatusLCD(select);//
根据需要检测忙
{
unsigned char dataR;
LCD_Data = 0xff;//
置位输入口,已实现输入
switch(select)
{
case 1:{LCD_CSA=1;LCD_CSB=0;break;}//
功能:从
LCD
读取数据
变量:
select
用于选择
LCD
屏的左右
,1
选择左屏,
2
选择右屏
***********************************************************/
unsigned char ReadDataLCD(unsigned char select)
unsigned char V_num,
unsigned char * puts );//
通用的显示函数
void Drawing_dot(unsigned char x,unsigned char y);
void Drawing_line_vertical(unsigned x);
switch(select)
{
case 1:{LCD_CSA=1;LCD_CSB=0;break;}//
左
case 2:{LCD_CSA=0;LCD_CSB=1;break;}//
右
default: break;
LCD_Data = 0xff;//
置位输入口,已实现输入
LCD_RS=0;LCD_RW=1;LCD_E=1;//
高电平读取数据
//_nop_();
//
若晶振速度高,可在此作延时处理
sbit LCD_CSA = P2^3;//H
选通,即高电平有效
sbit LCD_CSB =
P2^4;
#define LCD_Data P0//LCD
数据端口
8
位
#define R 1
#define L 2
/*****************************************
功能:清显示
RAM
区(清屏)
参数:
select
为驱动控制器选择
1
为左
2
为右
*******************************************************************************
向
LCD
写入命令
void LcdReset(void) //
初始化函数,完成液晶模块的初始设置
void clear_LCD(unsigned char select);//
清屏函数
void Clr_All_Lcd(void);//
全清屏函数
}
LCD_Data = WCLCD;
LCD_RS = 0;LCD_RW = 0;LCD_E = 1;
//_nop_();
//
若晶振速度高,可在此作延时处理