51单片机12864显示汉字画图画点常用例程

更新时间:2023-09-06 18:47:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

//以下程序都是在VC++6.0 上调试运行过的程序,没有错误,没有警告。

//单片机是STC89C52RC,但是在所有的51 52单片机上都是通用的。51只是一个学习的基础平台,你懂得。

//程序在关键的位置添加了注释。

////////////////////////////////画点例程//////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////以下是 主文件 main.c 的内容

#include<reg51.h>

#include"lcd12864.h"

//--声明全局函数--//

void Delay10ms(unsigned int c); //延时10ms

/*******************************************************************************

* 函 数 名 : main

* 函数功能 : 主函数

* 输 入 : 无

* 输 出 : 无

*******************************************************************************/

void main()

{

while(1)

{

LCD12864_ClearScreen();

LCD12864_DrowPoint(127,63);

while(1);

}

}

/*******************************************************************************

* 函 数 名 : Delay10ms

* 函数功能 : 延时函数,延时10ms

* 输 入 : 无

* 输 出 : 无

*******************************************************************************/

void Delay10ms(unsigned int c) //误差 0us

{

unsigned char a, b;

//--c已经在传递过来的时候已经赋值了,所以在for语句第一句就不用赋值了--// for (;c>0;c--)

{

for (b=38;b>0;b--)

{

for (a=130;a>0;a--);

}

}

}//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////以下是被调文件 lcd12864.c 的内容

#include"lcd12864.h"

/*******************************************************************************

* 函 数 名 : LCD12864_Delay1ms

* 函数功能 : 延时1MS

* 输 入 : c

* 输 出 : 无

*******************************************************************************/

void LCD12864_Delay1ms(uint c)

{

uchar a,b;

for(; c>0; c--)

{

for(b=199; b>0; b--)

{

for(a=1; a>0; a--);

}

}

}

/*******************************************************************************

* 函 数 名 : LCD12864_Busy

* 函数功能 : 检测LCD是否忙

* 输 入 : 无

* 输 出 : 1或0(1表示不忙,0表示忙)

*******************************************************************************/

uchar LCD12864_Busy(void)

{

uchar i = 0;

LCD12864_RS = 0; //选择命令

LCD12864_RW = 1; //选择读取

LCD12864_EN = 1;

LCD12864_Delay1ms(1);

while((LCD12864_DATAPORT & 0x80) == 0x80) //检测读取到的值

{

i++;

if(i > 100)

{

LCD12864_EN = 0;

return 0; //超过等待时间返回0表示失败

}

}

LCD12864_EN = 0;

return 1;

}

/*******************************************************************************

* 函 数 名 : LCD12864_WriteCmd

* 函数功能 : 写命令

* 输 入 : cmd

* 输 出 : 无

*******************************************************************************/

void LCD12864_WriteCmd(uchar cmd)

{

uchar i;

i = 0;

while( LCD12864_Busy() == 0)

{

LCD12864_Delay1ms(1);

i++;

if( i>100)

{

return; //超过等待退出

}

}

LCD12864_RS = 0; //选择命令

LCD12864_RW = 0; //选择写入

LCD12864_EN = 0; //初始化使能端

LCD12864_DATAPORT = cmd; //放置数据

LCD12864_EN = 1; //写时序

LCD12864_Delay1ms(1);

LCD12864_EN = 0;

}

/*******************************************************************************

* 函 数 名 : LCD12864_WriteData

* 函数功能 : 写数据

* 输 入 : dat

* 输 出 : 无

*******************************************************************************/

void LCD12864_WriteData(uchar dat)

{

uchar i;

i = 0;

while( LCD12864_Busy() == 0)

{

LCD12864_Delay1ms(1);

i++;

if( i>100)

{

return; //超过等待退出

}

}

LCD12864_RS = 1; //选择数据

LCD12864_RW = 0; //选择写入

LCD12864_EN = 0; //初始化使能端

LCD12864_DATAPORT = dat; //放置数据

LCD12864_EN = 1; //写时序

LCD12864_Delay1ms(1);

LCD12864_EN = 0;

}

/*******************************************************************************

* 函 数 名 : LCD12864_ReadData

* 函数功能 : 读取数据

* 输 入 : 无

* 输 出 : 读取到的8位数据

*******************************************************************************/

#ifdef LCD12864_PICTURE

uchar LCD12864_ReadData(void)

{

uchar i, readValue;

i = 0;

while( LCD12864_Busy() == 0)

{

LCD12864_Delay1ms(1);

i++;

if( i>100)

{

return 0; //超过等待退出

}

}

LCD12864_RS = 1; //选择命令

LCD12864_RW = 1;

LCD12864_EN = 0;

LCD12864_Delay1ms(1); //等待

LCD12864_EN = 1;

LCD12864_Delay1ms(1);

readValue = LCD12864_DATAPORT;

LCD12864_EN = 0;

return readValue;

}

#endif

/*******************************************************************************

* 函 数 名 : LCD12864_Init

* 函数功能 : 初始化LCD12864

* 输 入 : 无

* 输 出 : 无

*******************************************************************************/

void LCD12864_Init()

{

LCD12864_PSB = 1; //选择并行输入

LCD12864_RST = 1; //复位

LCD12864_WriteCmd(0x30); //选择基本指令操作

LCD12864_WriteCmd(0x0c); //显示开,关光标

LCD12864_WriteCmd(0x01); //清除LCD12864的显示内容

}

/*******************************************************************************

* 函 数 名 : LCD12864_ClearScreen

* 函数功能 : 在画图模式下,LCD12864的01H命令不能清屏,所以要自己写一个清

* * 屏函数

* 输 入 : 无

* 输 出 : 无

*******************************************************************************/

#ifdef LCD12864_PICTURE

void LCD12864_ClearScreen(void)

{

uchar i,j;

LCD12864_WriteCmd(0x34); //开启拓展指令集

for(i=0;i<32;i++) //因为LCD有纵坐标32格所以写三十二次

{

LCD12864_WriteCmd(0x80+i); //先写入纵坐标Y的值

LCD12864_WriteCmd(0x80); //再写入横坐标X的值

for(j=0;j<32;j++) //横坐标有16位,每位写入两个字节的的数据,也 { //就写入32次以为当写入两个字节之后横坐标会自 LCD12864_WriteData(0x00); //动加1,所以就不用再次写入地址了。 }

}

LCD12864_WriteCmd(0x36); //0x36扩展指令里面打开绘图显示

LCD12864_WriteCmd(0x30); //恢复基本指令集

}

#endif

/*******************************************************************************

* 函 数 名 : LCD12864_SetWindow

* 函数功能 : 设置在基本指令模式下设置显示坐标。注意:x是设置行,y是设置列

* 输 入 : x, y

* 输 出 : 无

*******************************************************************************/

void LCD12864_SetWindow(uchar x, uchar y)

{

uchar pos;

if(x == 0) // 第一行的地址是80H

{

x = 0x80;

}

else if(x == 1) //第二行的地址是90H

{

x = 0x90;

}

else if(x == 2) //第三行的地址是88H

{

x = 0x88;

}

else if(x == 3)

{

x = 0x98;

}

pos = x + y;

LCD12864_WriteCmd(pos);

}

/*******************************************************************************

* 函 数 名 : LCD12864_ClearScreen

* 函数功能 : 在画图模式下,LCD12864的01H命令不能清屏,所以要自己写一个清

* * 屏函数

* 输 入 : 无

* 输 出 : 无

*******************************************************************************/

#ifdef LCD12864_PICTURE

void LCD12864_DrowPic(uchar *a)

{

unsigned char i,j;

LCD12864_ClearScreen();

LCD12864_WriteCmd(0x34); //开启扩展指令集,并关闭画图显示。

for(i=0;i<32;i++) //因为LCD有纵坐标32格所以写三十二次

{

LCD12864_WriteCmd(0x80+i); //先写入纵坐标Y的值

LCD12864_WriteCmd(0x80); //再写入横坐标X的值

for(j=0; j<16; j++) //横坐标有16位,每位写入两个字节的的数据,也 { //就写入32次以为当写入两个字节之后横坐标会自 LCD12864_WriteData(*a); //动加1,所以就不用再次写入地址了。 a++;

}

}

for(i=0; i<32; i++) //因为LCD有纵坐标32格所以写三十二次

{

LCD12864_WriteCmd(0x80+i); //先写入纵坐标Y的值

LCD12864_WriteCmd(0x88); //再写入横坐标X的值

for(j=0; j<16; j++) //横坐标有16位,每位写入两个字节的的数据,也

{ //就写入32次以为当写入两个字节之后横坐标会自 LCD12864_WriteData(*a); //动加1,所以就不用再次写入地址了。 a++; }

}

LCD12864_WriteCmd(0x36); //开显示

LCD12864_WriteCmd(0x30); //转回基本指令集

}

/*******************************************************************************

* 函 数 名 : LCD12864_DrowPoint

* 函数功能 : 在一定的坐标点亮一个点,可以用于画线条

* 输 入 : x, y

* 输 出 : 无

*******************************************************************************/

void LCD12864_DrowPoint(uchar x, uchar y)

{

uint bt = 0, readValue = 0;

uchar x_adr, y_adr, h_bit, l_bit;

//--Y轴最大一共64,但是12864分为上半屏和下半屏,超过32就是下半屏了,--// //--地址得又从零开始了。所以对32求余数,得到Y轴的坐标,然后加上80H的基地址--//

y_adr = 0x80 + y % 32; //计算Y轴的地址

//--当Y大于31时是下半屏,X(水平位置的地址)是从88H开始的,而且它是16位一--//

//--个地址,所以对16求模。而上半屏的地址是从80H开始的--//

if(y>31)

{

x_adr = 0x88 + x / 16; //计算X轴的地址

}

else

{

x_adr = 0x80 + x / 16;

}

//--求出X(水平位置),点亮的点是在16位数据里面的哪一个位--//

//--所以对这个数求余数--//

bt = 0x8000 >> (x % 16);

LCD12864_WriteCmd(0x34); //进入拓展指令集

LCD12864_WriteCmd(y_adr); //读取数据的时候要先写入所取数据的地址 LCD12864_WriteCmd(x_adr);

LCD12864_ReadData(); //读取的第一个字节不要,

readValue = LCD12864_ReadData(); //从第二个字节开始接收。

readValue <<= 8;

readValue |= LCD12864_ReadData();

bt = bt | readValue;

h_bit = bt >> 8;

l_bit = bt;

LCD12864_WriteCmd(y_adr); //写入点的时候,从新写入地址,因为地址已经改变。

LCD12864_WriteCmd(x_adr);

LCD12864_WriteData(h_bit);

LCD12864_WriteData(l_bit);

LCD12864_WriteCmd(0x36); //开显示

LCD12864_WriteCmd(0x30); //关闭绘图指令集

}

#endif

//////////////////////////////////////////////////画图例程////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////以下是 主文件 main.c 的内容

#include<reg51.h>

#include"lcd12864.h"

//---图片代码---//

unsigned char code Photo1[] ={

0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,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,0x3F,0xC0,

0x80,0x42,0x04,0x20,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x8A,0x1F,

0xFC,0x42,0x04,0xF8,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,

0x00,0x00,0x00,0x00,0x00,0x01,0x2A,0x87,

0xF0,0xA2,0x0A,0xF8,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0xBF,0x84,

0x10,0xA2,0x0A,0x88,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x1F,

0xFC,0xA2,0x0A,0xF8,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x9F,0x90,

0x05,0x2F,0xCA,0xA4,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x03,

0xE1,0xA8,0x4A,0xA8,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0xBF,0xC2,

0x24,0x48,0x44,0x90,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x92,0x84,

0x24,0xA8,0x4A,0xA8,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0xA6,0x58,

0x3D,0x0F,0xD0,0xC4,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x1C,0xFF,0xC0,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x23,0x08,0x37,0x80,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x40,0x10,0x08,0x40,0x00,0xFF,0x90,

0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x81,0x86,0x10,0x40,0x00,0x08,0x08,

0x10,0xFF,0x86,0x00,0x00,0x00,0x00,0x00,

0x01,0x02,0x49,0x40,0x40,0x00,0x7F,0x0B,

0xFC,0x08,0x0F,0x00,0x00,0x00,0x00,0x00,

0x01,0x08,0x00,0x40,0x20,0x00,0x10,0x00,

0x10,0x49,0x0F,0x00,0x00,0x00,0x00,0x00,

0x02,0x08,0x00,0x20,0x20,0x01,0xFF,0xDD,

0x10,0x2A,0x0F,0x00,0x00,0x00,0x00,0x00,

0x04,0x31,0x83,0x20,0x20,0x00,0x20,0x04,

0x91,0xFF,0xC6,0x00,0x00,0x00,0x00,0x00,

0x04,0x52,0x44,0x90,0x20,0x00,0x7F,0x04,

0x90,0x1C,0x06,0x00,0x00,0x00,0x00,0x00,

0x09,0xA4,0x28,0x4C,0x10,0x00,0xA1,0x04,

0x10,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,

0x0E,0x44,0xE9,0xC3,0x90,0x01,0x3F,0x04,

0x70,0x49,0x06,0x00,0x00,0x00,0x00,0x00,

0x00,0x82,0xC5,0x81,0x70,0x00,0x21,0x0A,

0x01,0x88,0xC6,0x00,0x00,0x00,0x00,0x00,

0x01,0x01,0x83,0x00,0x80,0x00,0x3F,0x11,

0x01,0x0C,0x70,0x00,0x80,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x02,0x13,0x87,0x10,0x40,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x02,0x20,0x78,0xA0,0x40,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x02,0x20,0x00,0x60,0x40,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x02,0x21,0x80,0x60,0x40,0x00,0x00,0x71,

0xEE,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,

0x01,0x11,0x98,0x90,0x80,0x00,0x00,0x8E,

0x31,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,

0x01,0x08,0x18,0x80,0x80,0x00,0x01,0x24,

0x24,0x83,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x96,0x01,0x01,0x00,0x00,0x01,0x40,

0x28,0x03,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x49,0x86,0x03,0x00,0x00,0x01,0x40,

0x28,0x03,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x34,0x78,0x8C,0x00,0x00,0x01,0x00,

0x20,0x03,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x0E,0x01,0x30,0x00,0x00,0x00,0x80,

0x30,0x06,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x71,0x87,0xCE,0x00,0x00,0x00,0x40,

0x68,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0xE0,0x78,0x07,0x00,0x00,0x00,0x20,

0xC4,0x18,0x00,0x00,0x00,0x00,0x00,0x00,

0x01,0xAF,0xFF,0xC5,0x80,0x00,0x00,0x11,

0x82,0x30,0x00,0x00,0x00,0x00,0x00,0x00,

0x03,0xA9,0xB6,0x45,0xC0,0x00,0x00,0x0B,

0x01,0x60,0x00,0x00,0x00,0x00,0x00,0x00,

0x07,0x2F,0x03,0xC4,0xE0,0x00,0x00,0x06,

0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,

0x0E,0x16,0x01,0x88,0x70,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x0F,0x08,0x00,0x10,0xF0,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x0F,0x84,0x00,0x21,0xF0,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

};

/******************************************************************************/

unsigned char code Photo2[] ={

/*-- 调入了一幅图像:G:\HC-6800\12864\C语言\pz.bmp --*/

/*-- 宽度x高度=128x64 --*/

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFE,0x60, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x63,0x20, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x63,0x10,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x63,0x08, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x7E,0x08, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x6C,0x08, 0x1F,0xF8,0x3F,0xF8,0x7F,0xF0,0x0F,0xF9,0xF1,0xF0,0xFF,0x87,0xC3,0xC4,0x6C,0x08, 0x0E,0x7C,0x1E,0xFC,0x38,0xF8,0x3E,0xF8,0xE0,0xE0,0x1C,0x03,0xC1,0x84,0x66,0x08, 0x0E,0x1E,0x1C,0x3C,0x38,0x38,0x38,0x38,0xE0,0xE0,0x1C,0x03,0xE1,0x84,0x66,0x08, 0x0E,0x1E,0x1C,0x1C,0x38,0x18,0x78,0x38,0xE0,0xE0,0x1C,0x03,0xE1,0x82,0x63,0x10, 0x0E,0x0E,0x1C,0x1C,0x38,0x00,0xF0,0x18,0xE0,0xE0,0x1C,0x03,0xF1,0x81,0xF3,0xA0, 0x0E,0x0E,0x1C,0x3C,0x38,0xC0,0xF0,0x00,0xE0,0xE0,0x1C,0x03,0xF1,0x81,0x80,0x60, 0x0E,0x1E,0x1C,0x3C,0x38,0xC0,0xF0,0x00,0xE0,0xE0,0x1C,0x03,0x79,0x80,0x40,0x80, 0x0E,0x1E,0x1C,0xF8,0x39,0xC0,0xE0,0x00,0xE0,0xE0,0x1C,0x03,0x79,0x80,0x3F,0x00, 0x0E,0x7C,0x1F,0xF0,0x3F,0xC0,0xE0,0x00,0xFF,0xE0,0x1C,0x03,0x3D,0x80,0x00,0x00, 0x0F,0xF8,0x1D,0xE0,0x39,0xC0,0xE0,0x00,0xE0,0xE0,0x1C,0x03,0x3D,0x80,0x00,0x00, 0x0E,0x00,0x1D,0xE0,0x38,0xC0,0xE0,0x00,0xE0,0xE0,0x1C,0x03,0x1F,0x80,0x00,0x00, 0x0E,0x00,0x1C,0xF0,0x38,0xC0,0xF0,0x00,0xE0,0xE0,0x1C,0x03,0x1F,0x80,0x00,0x00, 0x0E,0x00,0x1C,0xF0,0x38,0x00,0xF0,0x00,0xE0,0xE0,0x1C,0x03,0x0F,0x80,0x00,0x00, 0x0E,0x00,0x1C,0x78,0x38,0x00,0xF0,0x18,0xE0,0xE0,0x1C,0x03,0x0F,0x80,0x00,0x00, 0x0E,0x00,0x1C,0x78,0x38,0x18,0x70,0x38,0xE0,0xE0,0x1C,0x03,0x07,0x80,0x00,0x00, 0x0E,0x00,0x1C,0x78,0x38,0x38,0x78,0x30,0xE0,0xE0,0x1C,0x03,0x07,0x80,0x00,0x00, 0x0E,0x00,0x1C,0x3C,0x38,0xF8,0x3E,0xF0,0xE0,0xE0,0x1C,0x03,0x03,0x80,0x00,0x00, 0x1F,0x00,0x3E,0x3E,0x7F,0xF0,0x1F,0xE1,0xF1,0xF0,0xFF,0x87,0x83,0x80,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0xF0,0x38,0x00,0x00,0x78,0x00,0x00,0x18,0x07,0x80,0x1C,0x03,0x80,0x00, 0x00,0x00,0x7C,0x7C,0x00,0x00,0x78,0x00,0x00,0x7C,0x07,0x80,0x1C,0x03,0xC0,0x00, 0x00,0x00,0x3C,0x70,0x00,0x00,0x70,0x00,0x07,0xFC,0x07,0x00,0x1C,0x03,0x80,0x00, 0x00,0x00,0x1C,0xE3,0xC0,0x00,0x70,0x00,0x1F,0xE1,0xC7,0x00,0x1C,0x03,0x80,0x00, 0x00,0x0F,0xFF,0xFF,0xE0,0x00,0x70,0x00,0x00,0xE1,0xE7,0x00,0x1C,0x03,0x80,0x00, 0x00,0x06,0x1C,0xE6,0x00,0xFF,0xFF,0xFC,0x00,0xE0,0xF7,0x00,0x1D,0x83,0x9E,0x00, 0x00,0x07,0x1C,0xE7,0x80,0xFF,0xFF,0xFC,0x00,0xE0,0xF7,0x03,0xFF,0xFF,0xFE,0x00, 0x00,0x03,0x9C,0xEF,0x80,0xE0,0x70,0x38,0x00,0xEE,0x67,0x00,0x1C,0x03,0x80,0x00, 0x00,0x03,0xDC,0xEE,0x00,0xE0,0x70,0x38,0x3F,0xFE,0x07,0x00,0x1C,0x03,0x80,0x00, 0x00,0x01,0xFC,0xFC,0x00,0xE0,0x70,0x38,0x01,0xE0,0x07,0x00,0x1C,0x03,0x80,0x00, 0x00,0x01,0xDC,0xF8,0xE0,0xE0,0x70,0x38,0x01,0xE1,0xC7,0x00,0x1D,0xC3,0xB8,0x00, 0x00,0x3F,0xFF,0xFF,0xF0,0xE0,0x70,0x38,0x03,0xF1,0xE7,0x00,0x1F,0xFF,0xFC,0x00, 0x00,0x3F,0xFF,0xFF,0xF0,0xE0,0x70,0x38,0x03,0xFC,0xE7,0x00,0x7E,0x38,0x38,0x00, 0x00,0x00,0x80,0x0C,0x00,0xFF,0xFF,0xF8,0x07,0xFE,0xE7,0xE3,0xFC,0x18,0x78,0x00, 0x00,0x00,0xFF,0xFE,0x00,0xE0,0x70,0x38,0x07,0xFE,0x07,0xF3,0xFC,0x1C,0x70,0x00, 0x00,0x00,0xFF,0xFE,0x00,0xE0,0x70,0x38,0x0F,0xEC,0x3F,0xC1,0x9C,0x1C,0xF0,0x00,

0x00,0x00,0xE0,0x1E,0x00,0x00,0x70,0x00,0x0E,0xE7,0xFF,0x00,0x1C,0x0E,0xE0,0x00, 0x00,0x00,0xE0,0x1E,0x00,0x00,0x70,0x00,0x1C,0xEF,0x07,0x00,0x1C,0x0F,0xE0,0x00, 0x00,0x00,0xFF,0xFE,0x00,0x00,0x70,0x00,0x38,0xE0,0x07,0x00,0x1C,0x07,0xC0,0x00, 0x00,0x00,0xE0,0x1E,0x00,0x00,0x70,0x00,0x30,0xE0,0x07,0x00,0x1C,0x07,0x80,0x00, 0x00,0x00,0xE0,0x1E,0x00,0x00,0x70,0x00,0x00,0xE0,0x07,0x00,0x1C,0x0F,0xE0,0x00, 0x00,0x00,0xE0,0x1E,0x00,0x00,0x70,0x00,0x00,0xE0,0x07,0x01,0xDC,0x3F,0xF8,0x00, 0x00,0x00,0xFF,0xFE,0x00,0x00,0x70,0x00,0x00,0xE0,0x07,0x01,0xFC,0x78,0xFF,0x00, 0x00,0x00,0xE0,0x1E,0x00,0x00,0x70,0x00,0x00,0xE0,0x07,0x00,0x7F,0xE0,0x3F,0x00, 0x00,0x00,0xC0,0x1C,0x00,0x00,0x70,0x00,0x00,0xC0,0x07,0x00,0x37,0x80,0x0C,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC, 0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

};

//--声明全局函数--//

void Delay10ms(unsigned int c); //延时10ms

/*******************************************************************************

* 函 数 名 : main

* 函数功能 : 主函数

* 输 入 : 无

* 输 出 : 无

*******************************************************************************/

void main()

{

while(1)

{

LCD12864_DrowPic(&Photo1[0]);

Delay10ms(500);

LCD12864_DrowPic(&Photo2[0]);

Delay10ms(500);

}

}

/*******************************************************************************

* 函 数 名 : Delay10ms

* 函数功能 : 延时函数,延时10ms

* 输 入 : 无

* 输 出 : 无

*******************************************************************************/

void Delay10ms(unsigned int c) //误差 0us

{

unsigned char a, b;

//--c已经在传递过来的时候已经赋值了,所以在for语句第一句就不用赋值了--// for (;c>0;c--)

{

for (b=38;b>0;b--)

{

for (a=130;a>0;a--);

}

}

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////以下是被调文件 lcd12864.c 的内容

#include<reg51.h>

#include"lcd12864.h"

//---图片代码---//

unsigned char code Photo1[] ={

0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,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,0x3F,0xC0,

0x80,0x42,0x04,0x20,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x8A,0x1F,

0xFC,0x42,0x04,0xF8,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,

0x01,0xFF,0xDE,0x88,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x01,0x2A,0x87,

0xF0,0xA2,0x0A,0xF8,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0xBF,0x84,

0x10,0xA2,0x0A,0x88,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x1F,

0xFC,0xA2,0x0A,0xF8,0x00,0x00,0x00,0x00,

0x05,0x2F,0xCA,0xA4,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x03,

0xE1,0xA8,0x4A,0xA8,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0xBF,0xC2,

0x24,0x48,0x44,0x90,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x92,0x84,

0x24,0xA8,0x4A,0xA8,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0xA6,0x58,

0x3D,0x0F,0xD0,0xC4,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x1C,0xFF,0xC0,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x23,0x08,0x37,0x80,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x40,0x10,0x08,0x40,0x00,0xFF,0x90,

0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x81,0x86,0x10,0x40,0x00,0x08,0x08,

0x10,0xFF,0x86,0x00,0x00,0x00,0x00,0x00,

0x01,0x02,0x49,0x40,0x40,0x00,0x7F,0x0B,

0xFC,0x08,0x0F,0x00,0x00,0x00,0x00,0x00,

0x01,0x08,0x00,0x40,0x20,0x00,0x10,0x00,

0x10,0x49,0x0F,0x00,0x00,0x00,0x00,0x00,

0x02,0x08,0x00,0x20,0x20,0x01,0xFF,0xDD,

0x10,0x2A,0x0F,0x00,0x00,0x00,0x00,0x00,

0x04,0x31,0x83,0x20,0x20,0x00,0x20,0x04,

0x91,0xFF,0xC6,0x00,0x00,0x00,0x00,0x00,

0x04,0x52,0x44,0x90,0x20,0x00,0x7F,0x04,

0x90,0x1C,0x06,0x00,0x00,0x00,0x00,0x00,

0x09,0xA4,0x28,0x4C,0x10,0x00,0xA1,0x04,

0x10,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,

0x0E,0x44,0xE9,0xC3,0x90,0x01,0x3F,0x04,

0x70,0x49,0x06,0x00,0x00,0x00,0x00,0x00,

0x00,0x82,0xC5,0x81,0x70,0x00,0x21,0x0A,

0x01,0x88,0xC6,0x00,0x00,0x00,0x00,0x00,

0x01,0x01,0x83,0x00,0x80,0x00,0x3F,0x11,

0xFC,0x08,0x00,0x00,0x00,0x00,0x00,0x00,

0x01,0x0C,0x70,0x00,0x80,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x02,0x13,0x87,0x10,0x40,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x02,0x20,0x78,0xA0,0x40,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x02,0x21,0x80,0x60,0x40,0x00,0x00,0x71,

0xEE,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,

0x01,0x11,0x98,0x90,0x80,0x00,0x00,0x8E,

0x31,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,

0x01,0x08,0x18,0x80,0x80,0x00,0x01,0x24,

0x24,0x83,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x96,0x01,0x01,0x00,0x00,0x01,0x40,

0x28,0x03,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x49,0x86,0x03,0x00,0x00,0x01,0x40,

0x28,0x03,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x34,0x78,0x8C,0x00,0x00,0x01,0x00,

0x20,0x03,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x0E,0x01,0x30,0x00,0x00,0x00,0x80,

0x30,0x06,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x71,0x87,0xCE,0x00,0x00,0x00,0x40,

0x68,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0xE0,0x78,0x07,0x00,0x00,0x00,0x20,

0xC4,0x18,0x00,0x00,0x00,0x00,0x00,0x00,

0x01,0xAF,0xFF,0xC5,0x80,0x00,0x00,0x11,

0x82,0x30,0x00,0x00,0x00,0x00,0x00,0x00,

0x03,0xA9,0xB6,0x45,0xC0,0x00,0x00,0x0B,

0x01,0x60,0x00,0x00,0x00,0x00,0x00,0x00,

0x07,0x2F,0x03,0xC4,0xE0,0x00,0x00,0x06,

0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,

0x0E,0x16,0x01,0x88,0x70,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x0F,0x08,0x00,0x10,0xF0,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x0F,0x84,0x00,0x21,0xF0,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

};

/******************************************************************************/

unsigned char code Photo2[] ={

/*-- 调入了一幅图像:G:\HC-6800\12864\C语言\pz.bmp --*/

/*-- 宽度x高度=128x64 --*/

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFE,0x60, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x63,0x20, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x63,0x10, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x63,0x08, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x7E,0x08, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x6C,0x08, 0x1F,0xF8,0x3F,0xF8,0x7F,0xF0,0x0F,0xF9,0xF1,0xF0,0xFF,0x87,0xC3,0xC4,0x6C,0x08, 0x0E,0x7C,0x1E,0xFC,0x38,0xF8,0x3E,0xF8,0xE0,0xE0,0x1C,0x03,0xC1,0x84,0x66,0x08, 0x0E,0x1E,0x1C,0x3C,0x38,0x38,0x38,0x38,0xE0,0xE0,0x1C,0x03,0xE1,0x84,0x66,0x08, 0x0E,0x1E,0x1C,0x1C,0x38,0x18,0x78,0x38,0xE0,0xE0,0x1C,0x03,0xE1,0x82,0x63,0x10,

本文来源:https://www.bwwdw.com/article/9lch.html

Top