打印

LCD12864问题

[复制链接]
2138|9
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
沙发
cyw183846168|  楼主 | 2012-3-21 16:26 | 只看该作者
下面是我自己写的程序,但是我放在protus上仿真不起来
#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit RS=P2^3;
sbit RW=P2^2;
sbit E=P2^1;
sbit RST=P2^0;
sbit CS1=P2^4;
sbit CS2=P2^5;
uchar code a[]={/*--  文字:  欢  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x28,0x24,0x22,0x21,0x26,0x38,0x04,0x18,0xF0,0x17,0x10,0x10,0x14,0x18,0x10,0x00,
0x04,0x08,0x32,0xC2,0xC2,0x34,0x04,0x08,0x30,0xC0,0x60,0x18,0x0C,0x06,0x04,0x00};
uchar code a1[]={/*--  文字:  迎  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x02,0x82,0x73,0x20,0x00,0x3F,0x20,0x40,0x40,0x3F,0x20,0x20,0x20,0x3F,0x00,0x00,
0x02,0x04,0xF8,0x04,0x02,0xE2,0x42,0x82,0x02,0xFA,0x02,0x42,0x22,0xC2,0x02,0x00};
uchar code a2[]={/*--  文字:  使  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x02,0x04,0x0F,0x38,0xE0,0x4F,0x29,0x29,0x29,0xFF,0x29,0x29,0x29,0x2F,0x20,0x00,
0x00,0x00,0xFE,0x00,0x02,0x82,0x44,0x28,0x30,0xC8,0x08,0x0C,0x04,0x86,0x04,0x00};
uchar code a3[]={/*--  文字:  用  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x00,0x00,0x7F,0x44,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x7F,0x00,0x00,
0x01,0x02,0x0C,0xF0,0x40,0x40,0x40,0x40,0xFF,0x40,0x40,0x42,0x41,0xFE,0x00,0x00};
uchar code a4[]={/*--  文字:  甲  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x00,0x7F,0x44,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x7F,0x00,0x00,0x00,
0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0xFF,0x40,0x40,0x40,0x40,0xE0,0x00,0x00,0x00};
uchar code a5[]={/*--  文字:  醛  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x4F,0x48,0x7F,0x48,0x7F,0x4F,0x60,0x21,0xF2,0x2C,0x24,0xF2,0x21,0x20,0x20,0x00,
0xFE,0x64,0xA4,0x24,0xA4,0xFE,0x80,0x12,0x92,0x92,0xFE,0x92,0x12,0x82,0x82,0x00};
uchar code a6[]={/*--  文字:  检  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x10,0x11,0x16,0xFF,0x14,0x12,0x08,0x12,0x22,0xC2,0x22,0x12,0x0A,0x08,0x08,0x00,
0x40,0x80,0x00,0xFE,0x00,0x04,0x44,0x34,0x84,0x74,0x0C,0x14,0xE4,0x44,0x04,0x00};
uchar code a7[]={/*--  文字:  测  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x10,0x8C,0x61,0x06,0x00,0x7F,0x40,0x4F,0x40,0x7F,0x00,0x1F,0x00,0x00,0xFF,0x00,
0x20,0x3F,0xC0,0x00,0x01,0xE2,0x0C,0xF0,0x08,0xE6,0x00,0xE0,0x02,0x01,0xFE,0x00};
uchar code a8[]={/*--  文字:  仪  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x02,0x04,0x0F,0x30,0xC0,0x00,0x1C,0x03,0x80,0x70,0x20,0x07,0x38,0x00,0x00,0x00,
0x00,0x00,0xFF,0x00,0x02,0x02,0x04,0x08,0xD0,0x20,0xD0,0x08,0x04,0x06,0x04,0x00};
uchar code a9[]={/*--  文字:  淮  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x08,0x86,0x60,0x07,0x1A,0x04,0x1F,0xF2,0x12,0x92,0x7F,0x12,0x12,0x12,0x10,0x00,
0x20,0x20,0xFE,0x00,0x00,0x00,0xFE,0x44,0x44,0x44,0xFC,0x44,0x44,0x44,0x04,0x00};
uchar code a10[]={/*--  文字:  南  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x20,0x20,0x27,0x24,0x24,0x26,0x2D,0xF4,0x24,0x25,0x26,0x24,0x24,0x67,0x20,0x00,
0x00,0x00,0xFE,0x20,0xA0,0xA0,0xA0,0xFE,0xA0,0xA0,0xA0,0xA4,0x22,0xFC,0x00,0x00};
uchar code a11[]={/*--  文字:  师  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x3F,0x00,0x00,0xFF,0x00,0x4F,0x48,0x48,0x48,0x7F,0x48,0x48,0x48,0x4F,0x00,
0x02,0xE4,0x08,0x70,0x80,0x00,0xF0,0x00,0x00,0x00,0xFF,0x00,0x20,0x10,0xE0,0x00};
uchar code a12[]={/*--  文字:  范  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x22,0x29,0x25,0x26,0x20,0xF0,0x20,0x27,0x24,0x34,0xF4,0x24,0x27,0x20,0x20,0x00,
0x10,0x90,0x1F,0x20,0xC0,0x00,0x00,0xFC,0x02,0x02,0x42,0x62,0xC2,0x0E,0x00,0x00};
uchar code a13[]={/*--  文字:  学  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x02,0x0C,0x08,0x48,0x3A,0x2A,0x0A,0x8A,0x7A,0x2B,0x0A,0x18,0xEA,0x4C,0x08,0x00,
0x00,0x40,0x40,0x40,0x40,0x40,0x42,0x41,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x00};
uchar code a14[]={/*--  文字:  院  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x7F,0x40,0x4C,0x52,0x61,0x30,0x24,0x24,0xA4,0x64,0x24,0x24,0x24,0x30,0x20,0x00,
0xFF,0x00,0x40,0x20,0xC1,0x82,0x8C,0xF0,0x80,0x80,0xFE,0x81,0x81,0x81,0x8F,0x00};
uchar code a15[]={/*--  文字:  开  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x02,0x42,0x42,0x42,0x42,0x7F,0x42,0x42,0x42,0x42,0x7F,0x42,0x42,0x42,0x42,0x00,
0x00,0x02,0x04,0x08,0x30,0xC0,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00};
uchar code a16[]={/*--  文字:  始  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x08,0x09,0x0E,0xF8,0x48,0x0F,0x00,0x04,0x0E,0x14,0xE4,0x44,0x14,0x0E,0x04,0x00,
0x02,0x84,0x48,0x30,0x60,0x90,0x0C,0x00,0xFE,0x84,0x84,0x84,0x84,0xFE,0x00,0x00};
uchar code a17[]={/*--  文字:  测  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x10,0x8C,0x61,0x06,0x00,0x7F,0x40,0x4F,0x40,0x7F,0x00,0x1F,0x00,0x00,0xFF,0x00,
0x20,0x3F,0xC0,0x00,0x01,0xE2,0x0C,0xF0,0x08,0xE6,0x00,0xE0,0x02,0x01,0xFE,0x00};
uchar code a18[]={/*--  文字:  量  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x02,0x02,0x02,0xFB,0xAA,0xAA,0xAA,0xAB,0xAA,0xAA,0xAA,0xFB,0x02,0x02,0x02,0x00,
0x02,0x02,0x02,0xEA,0xAA,0xAA,0xAA,0xFE,0xAA,0xAA,0xAA,0xEA,0x0A,0x02,0x02,0x00};
uchar code a19[]={/*--  文字:  返  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x02,0x42,0x3B,0x10,0x00,0x00,0x7F,0x4A,0x49,0x48,0x48,0x49,0xCE,0x40,0x00,0x00,
0x02,0x04,0xF8,0x04,0x12,0x62,0x8A,0x0A,0x12,0xA2,0x42,0xA2,0x12,0x0A,0x00,0x00};
uchar code a20[]={/*--  文字:  回  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x7F,0x40,0x40,0x4F,0x48,0x48,0x48,0x48,0x48,0x4F,0x40,0x40,0x7F,0x00,0x00,
0x00,0xFE,0x02,0x02,0xE2,0x22,0x22,0x22,0x22,0x22,0xE2,0x02,0x02,0xFE,0x00,0x00};
uchar code a21[]={/*--  文字:  主  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x00,0x08,0x08,0x08,0x08,0x88,0x6F,0x48,0x08,0x08,0x08,0x19,0x08,0x00,0x00,
0x00,0x04,0x84,0x84,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0x84,0x84,0x8C,0x04,0x00};
uchar code a22[]={/*--  文字:  页  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x80,0x80,0x80,0x9F,0x90,0xB0,0xD7,0x90,0x90,0x90,0x9F,0x80,0x80,0x80,0x00,
0x00,0x02,0x02,0x02,0xF4,0x04,0x08,0xF0,0x10,0x08,0x04,0xF4,0x02,0x03,0x00,0x00};
uchar code a23[]={/*--  文字:  面  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x40,0x4F,0x48,0x48,0x5F,0x69,0x49,0x49,0x4F,0x48,0x48,0x48,0x4F,0x40,0x00,
0x00,0x00,0xFE,0x04,0x04,0xFC,0x24,0x24,0x24,0xFC,0x04,0x04,0x04,0xFE,0x00,0x00};
uchar code a24[]={/*--  文字:  确  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x21,0x27,0x3A,0x22,0x23,0x08,0x1F,0xE9,0x49,0x4F,0x59,0x69,0x4F,0x00,0x00,
0x80,0x00,0xFC,0x10,0x11,0xF2,0x0C,0xF0,0x20,0x20,0xFC,0x22,0x21,0xFE,0x00,0x00};
uchar code a25[]={/*--  文字:  认  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x02,0x82,0x42,0x33,0x20,0x00,0x00,0x00,0x01,0xFE,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xFE,0x04,0x09,0x06,0x18,0xE0,0x00,0xC0,0x30,0x0C,0x03,0x02,0x00};
uchar code a26[]={/*--  文字:  取  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x40,0x40,0x7F,0x49,0x49,0x49,0x7F,0x40,0x40,0x3E,0x21,0x20,0x21,0x3E,0x20,0x00,
0x08,0x08,0xF0,0x10,0x10,0x20,0xFF,0x20,0x44,0x08,0x90,0x60,0x90,0x0C,0x08,0x00};
uchar code a27[]={/*--  文字:  消  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x10,0x0C,0x80,0x63,0x0C,0x00,0x27,0x1C,0x04,0xFC,0x04,0x0C,0x14,0x27,0x00,0x00,
0x20,0x20,0xFF,0x00,0x00,0x00,0xFF,0x90,0x90,0x90,0x90,0x92,0x91,0xFE,0x00,0x00};
uchar code a28[]={/*--  文字:  浓  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x08,0x86,0x60,0x07,0x00,0x1C,0x11,0x17,0x3A,0xD1,0x10,0x10,0x14,0x19,0x10,0x00,
0x20,0x20,0xFF,0x08,0x10,0x60,0x80,0xFF,0x02,0x84,0x60,0x98,0x84,0x03,0x02,0x00};
uchar code a29[]={/*--  文字:  度  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x00,0x3F,0x20,0x24,0x24,0x3F,0xA5,0x65,0x25,0x3F,0x24,0x24,0x24,0x20,0x00,
0x01,0x06,0xF8,0x01,0x01,0x42,0x62,0x54,0x48,0x48,0x54,0x64,0x42,0x03,0x02,0x00};
uchar code a30[]={/*--  文字:  :  --*/
/*--  新宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
void delay(unsigned long delay_time)//延迟函数
{
while(delay_time)
{
delay_time--;
}
}
/*忙函数*/
void Busy(void)
{               
RS=0;
RW=1;
P0=0x00;      
RS=0;      
RW=1;           
E=1;           
while(P0&0x80);
E=0;                           
}
//写数据
void write_data(uchar Data)
{
Busy();
RS=1;
RW=0;
P0=Data;
E=1;
delay(10);               
E=0;
}
//写指令
void write_command(uchar command)
{
Busy();
RS=0;
RW=0;
P0=command;
E=1;
delay(10);
E=0;
}
void Set_page(uchar page)//设置页LCD12864共8页一页是8行点阵点
{
page=0xb8|page;//页的首地址为0XB8
write_command(page);
}
void Set_line(uchar starline)//设置显示的起始行
{
starline=0xc0|starline;//起始行地址为0XC0
write_command(starline);//设置从哪行开始:共0-63;一般从0开始
}
void Set_column(uchar column)//设置显示的列
{
column=column&0x3f;//列的最大值为64
column=0x40|column;//列的首地址为0X40
write_command(column);
}
void Setonoff(uchar onoff)//显示开关函数,0X3E是关显示,0X3F是开显示
{
onoff=0x3e|onoff;//onoff只能为0或1
write_command(onoff);
}
void Selectscreen(uchar screen)//选屏
{
switch(screen)
{
case 0:CS1=0;CS2=0;break;//全屏
case 1:CS1=0;CS2=1;break;//左半屏
case 2:CS1=1;CS2=0;break;//右半屏
default: break;
}
}
//清屏
void clean(uchar screen)
{
uchar i,j;
Selectscreen(screen);
for(i=0;i<8;i++)//控制页数共8页
{
Set_page(i);
Set_column(0);
for(j=0;j<64;j++)//控制列数共64列
{
write_data(0x00);//写入0,地址指针自动加1
  }
}
}
void InitLCD()//LCD初始化
{
Busy();
Selectscreen(0);
Setonoff(0);//关显示
Selectscreen(0);
Setonoff(1);//关显示
Selectscreen(0);
clean(0);//清屏
Set_line(0);//开始行0
}
/*void display(uchar ss,uchar page,uchar column,uchar *a)//显示汉字
{
uchar i;
Selectscreen(ss);
Set_page(page);//写上半页
Set_column(column);//控制列
for(i=0;i<16;i++)//控制16列的数据输出
{
write_data(a[i]);
}
Set_page(page+1);
Set_column(column);
for(i=0;i<16;i++)
{
write_data(a[i+16]);
}
}*/
void main(void)
{
uchar i;
InitLCD();
clean(0);
Set_line(0);
Selectscreen(1);
Set_page(0);
Set_column(0x40);
for(i=0;i<16;i++)
{
write_data(a1[i]);
}
Set_page(1);
Set_column(0x40);
for(i=0;i<16;i++)
{
write_data(a1[i+16]);
}

while(1);
}

使用特权

评论回复
板凳
cyw183846168|  楼主 | 2012-3-21 16:27 | 只看该作者
在protus上仿真的结果如图

使用特权

评论回复
地板
cyw183846168|  楼主 | 2012-3-21 16:29 | 只看该作者
这个就是仿真后的图

LCD.jpg (17.15 KB )

LCD.jpg

使用特权

评论回复
5
cyw183846168|  楼主 | 2012-3-21 16:30 | 只看该作者
这个是引脚图

lianx.jpg (175.17 KB )

lianx.jpg

使用特权

评论回复
6
cyw183846168|  楼主 | 2012-3-23 11:39 | 只看该作者
难道,没牛人帮忙看看吗?

使用特权

评论回复
7
NE5532| | 2012-3-23 16:56 | 只看该作者
交作业糊弄老师的娃伤不起啊~~!

使用特权

评论回复
8
yes19891989| | 2012-3-26 14:44 | 只看该作者
不是没有牛人帮你  实在是   你自己好好找找原因吧  如果是什么很难得东西我估计牛人们就帮你了  你这完全是像楼上说的  老师留的作业  又不是很难  自己做出来不行啊  还来21上求助来了  很是不应该  希望楼主自己找出问题的所在  这样比直接求人得出的结果要好的多

使用特权

评论回复
9
joing1999| | 2013-4-7 08:44 | 只看该作者
发个我们的历程你看看吧……
/***************************************
*型号:VS12864G-1
*芯片:89S52(11.0592M)
*编写:Nicker
*日期:2008/9/18
*修改:2009/8/23
*
***************************************/
#include <reg52.h>

#define uint       unsigned int
#define uchar      unsigned char
#define disp_off   0x3e
#define disp_on    0x3f
#define disp_x     0xb8
#define disp_z     0xc0
#define disp_y     0x40
#define comm       0
#define dat        1
#define data_ora   P1       //MCU P1<------> LCM

sbit rs =P3^0;  //Data or Instrument Select,H:写数据,L:写指令
sbit rw =P3^1;  //Write or Read,H:read,L:write
sbit e  =P3^2;  //读写使能
sbit cs1=P3^3;  //cs1=H,选择左半屏
sbit cs2=P3^4;  //cs2=H,选择右半屏
sbit rst=P3^5;  //Lcm reset,低有效
sbit bf =P1^7;
sbit res=P1^4;

void chk_busy (void);

unsigned  char code pic1[]={
0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,
0xF8,0x7C,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0xF8,0xF8,0xF8,0xF8,0xF8,
0xF8,0xC0,0x00,0xC0,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0x18,0xDC,0xDC,0xDC,0xDC,
0xDC,0xDC,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
0xC0,0xC0,0x80,0x80,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x00,0x80,0xC0,0xC0,
0xC0,0xC0,0xC0,0x80,0x00,0x40,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,
0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0x7C,0x3E,0x1F,0x0F,0x07,0x03,0x01,
0x00,0x00,0x00,0x01,0x03,0x07,0x8F,0xDF,0xFF,0xFE,0xFC,0x7C,0x3E,0x1F,0x0F,0x07,
0x0F,0x1E,0x3C,0x78,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x03,0x0F,0x3F,0x7F,0xFF,
0xFF,0xFF,0xF8,0xFF,0xFF,0xFF,0xFF,0x3F,0x0F,0x03,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xCD,0xED,0xED,0xEF,0xEF,
0xEF,0xEF,0xEF,0xEF,0x6F,0x01,0x0F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFF,0xFF,
0x3F,0xFF,0xFF,0xFF,0xFC,0xFE,0xFF,0xFF,0xFF,0x7F,0x0F,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x02,0x07,0x0F,0x1F,0x3F,0x7F,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x06,0x8F,0xDF,0xFF,0xFF,0xF9,0xF0,0xE0,0xC0,0x80,0x00,0x00,
0x00,0x80,0xC0,0xE0,0xF0,0x79,0x3F,0x1F,0x0F,0x06,0xE0,0xE0,0xF8,0xF8,0xF8,0xF9,
0xF9,0xB9,0xB9,0xB9,0xB9,0x79,0x78,0x78,0x78,0x70,0x60,0x00,0x01,0x01,0xF9,0xF9,
0xF9,0xF9,0xF8,0xF8,0xC0,0xC0,0xC0,0xC0,0xC1,0xC1,0xC1,0x81,0x01,0x01,0x81,0xC1,
0xC1,0xC1,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC1,0xC1,0xC1,0xC1,0x81,0x81,0x01,0x00,
0x00,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC0,0xC0,0xC0,0x00,0x00,0x00,0xC0,
0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7E,
0xFC,0xF8,0xFC,0x7E,0x3F,0x1F,0x0F,0x07,0x03,0x01,0x01,0x03,0x07,0x0F,0x1F,0x1E,
0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xE3,0xE3,0xE7,0xE7,0xEF,0xEF,
0xEF,0xEF,0xCF,0xCF,0xDF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x7C,0x00,0x00,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x03,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xF9,0xFD,
0xFD,0xFD,0xFD,0xFD,0xFD,0xCD,0xEF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xF7,0xE3,0xE3,0xF7,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
0x00,0x01,0x00,0x00,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,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x81,0x81,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,
0x01,0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x81,0x81,0x80,0x00,0x00,0x01,
0x01,0x01,0x41,0xC1,0xC1,0xC1,0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,
0x00,0x01,0x01,0xC1,0xC1,0xC1,0x81,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xCF,
0x0F,0x0F,0x0F,0x0F,0x0F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xE0,0x7C,0x7F,0x7F,0xBF,0xB2,
0xB0,0xB0,0x94,0x9C,0xBC,0xFC,0xF8,0xF0,0xF8,0xEC,0xEF,0xCF,0xC7,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x1E,0xFE,0xFE,0xF2,0xB3,0x9B,0x9B,
0x9B,0x9B,0x8B,0xCB,0xFF,0xFF,0x7F,0x0F,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x80,0x08,0x8C,0x8C,0xFE,0xFF,0xFF,0xC7,0xE3,0x63,0xC8,0x88,
0x98,0x98,0x98,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
0xC0,0xC0,0xC0,0xE1,0xFF,0xFF,0x6F,0x60,0x20,0x20,0x60,0x60,0xF0,0xFF,0xFF,0x3F,
0x38,0x18,0x18,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x2F,0x37,0x33,0x33,0xFF,0xFF,0x7F,0x19,
0x99,0x09,0x01,0xCF,0xFF,0x7C,0x7C,0x04,0xFE,0xFF,0x07,0x03,0x00,0x00,0x80,0xC0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x70,0xF0,0xE0,0xE1,0xE5,0xFD,0xFC,0x38,
0x03,0xFB,0xFF,0xFF,0x61,0x71,0x7E,0x3E,0x1C,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,0x83,0xC1,0xE3,0x7B,0x3D,0x1F,0xBF,0xFF,0x7E,0x06,0x16,0x1E,0x18,0x18,
0x19,0x19,0x1D,0xFC,0xFF,0xFF,0x06,0x06,0x06,0x06,0x06,0x04,0x00,0x60,0xE0,0x60,
0x60,0x20,0x38,0xF8,0xFF,0xFF,0x06,0x02,0x04,0x1C,0x3C,0x76,0xE6,0xE7,0xFF,0x7F,
0x3F,0x0F,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x1F,0x1F,0x0F,0x07,0x0B,
0x0D,0x0E,0x07,0x03,0x01,0x00,0x00,0x00,0x07,0x0F,0x1E,0x1C,0x1C,0x1C,0x0F,0x0F,
0x0F,0x04,0x00,0x00,0x08,0x18,0x18,0x1C,0x1C,0x08,0x0D,0x0C,0x0F,0x0F,0x0F,0x0C,
0x0C,0x07,0x07,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0x00,0x00,0x00,
0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x1F,0x0F,0x0C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x03,0x3F,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x08,0x1C,0x3F,0x3F,0x1F,0x08,0x0C,0x0C,0x0E,0x06,0x06,0x03,0x03,0x01,0x03,
0x03,0x0F,0x1E,0x1E,0x1C,0x1C,0x1C,0x18,0x08,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,
};

unsigned char code pic2[]={
0x80,0x60,0xDE,0x48,0x48,0x48,0x00,0xF2,0x14,0x18,0x10,0x18,0x16,0xF0,0x00,0x00,
0x00,0x00,0x00,0x7C,0x54,0xD4,0x54,0x54,0x54,0xD4,0x54,0x7C,0x00,0x00,0x00,0x00,
0x20,0x24,0x24,0xE4,0xFC,0xA2,0x22,0x00,0x44,0x98,0x00,0x00,0xFE,0x00,0x00,0x00,
0x10,0x10,0x10,0xFE,0x90,0x50,0x00,0x90,0x90,0x90,0xFE,0x90,0x90,0x90,0x10,0x00,
0x00,0x08,0x08,0x88,0xC8,0x68,0x58,0x4E,0x48,0x48,0x48,0xC8,0x08,0x08,0x08,0x00,
0xFC,0x04,0x64,0x9C,0x04,0x00,0xFC,0x94,0x94,0x94,0x94,0x94,0xFC,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x60,0x1C,0x08,0x00,0x00,0x1C,0x20,0xC0,0x80,0x00,0x00,0x00,
0x00,0x20,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0xFC,0x00,0x00,
0x02,0x02,0xFF,0x42,0x22,0x92,0x80,0x41,0x31,0x0F,0x01,0x7F,0x81,0x81,0xF0,0x00,
0x40,0x42,0x44,0x58,0x40,0x7F,0x40,0x40,0x40,0x7F,0x50,0x48,0x46,0x40,0x40,0x00,
0x08,0x04,0x03,0x00,0xFF,0x00,0x09,0x08,0x08,0x05,0x04,0x04,0xFF,0x02,0x02,0x00,
0x02,0x82,0x01,0xFF,0x00,0x80,0x80,0x41,0x26,0x18,0x18,0x24,0x43,0xC0,0x40,0x00,
0x04,0x02,0x01,0x00,0xFF,0x12,0x12,0x12,0x52,0x92,0x92,0xFF,0x00,0x00,0x00,0x00,
0xFF,0x00,0x04,0x08,0x07,0x00,0xFF,0x80,0x41,0x06,0x18,0x24,0x42,0xC0,0x40,0x00,
0x00,0x02,0x41,0xE0,0x50,0x48,0x47,0x62,0x20,0x20,0x28,0xF0,0x61,0x03,0x01,0x00,
0x00,0x00,0x3F,0x09,0x09,0x09,0x09,0x09,0x09,0x1F,0x00,0x40,0x80,0x7F,0x00,0x00,
0x10,0xF0,0x10,0x10,0xD0,0x10,0x20,0x00,0x00,0xE0,0x10,0x10,0x10,0x10,0x70,0x00,
0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x10,0x11,0xF0,0x00,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x10,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,
0x40,0x7F,0x41,0x41,0x47,0x40,0x30,0x00,0x00,0x70,0x41,0x42,0x42,0x44,0x38,0x00,
0x00,0x00,0x00,0x61,0x61,0x00,0x00,0x00,0x1F,0x61,0x18,0x07,0x18,0x61,0x1F,0x01,
0x1F,0x61,0x18,0x07,0x18,0x61,0x1F,0x01,0x1F,0x61,0x18,0x07,0x18,0x61,0x1F,0x01,
0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x41,0x41,0x7F,0x42,0x41,0x01,0x03,0x00,
0x00,0x41,0x63,0x5C,0x1D,0x63,0x41,0x00,0x00,0x40,0x40,0x7F,0x40,0x40,0x00,0x00,
0x00,0x1C,0x22,0x41,0x41,0x41,0x22,0x00,0x00,0x1C,0x22,0x41,0x41,0x21,0x7F,0x40,
0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x41,0x41,0x41,0x22,0x00,
0x00,0x3E,0x41,0x41,0x41,0x41,0x3E,0x00,0x41,0x7F,0x41,0x01,0x7F,0x41,0x01,0x7E,
0x00,0xFC,0x84,0x84,0x44,0x3C,0x54,0x94,0x54,0x34,0x14,0x04,0x04,0xFC,0x00,0x00,
0x80,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84,0x84,0x80,0x20,0x10,0xC8,0x8E,0x04,0x00,
0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x7E,0x48,0x48,0x48,0xE8,0x48,0x00,0x00,0x00,
0xFC,0x04,0x24,0x54,0x8C,0x10,0x90,0x70,0x1E,0xD0,0x10,0x10,0x10,0x10,0x00,0x00,
0x20,0xC2,0x0C,0xC0,0x30,0x08,0xC8,0x38,0x08,0xCA,0x7C,0x48,0x48,0xC8,0x08,0x00,
0x00,0x00,0x00,0x00,0xFC,0x54,0x54,0x54,0x54,0x54,0x54,0xFC,0x00,0x00,0x00,0x00,
0x20,0xA0,0xFE,0xA0,0x20,0x08,0xE8,0xA8,0xBE,0xA8,0xA8,0xBE,0xE8,0x08,0x00,0x00,
0x20,0x20,0xFE,0x20,0x20,0x00,0x10,0x10,0xFE,0x10,0x10,0x10,0xF0,0x00,0x00,0x00,
0x00,0xFF,0x84,0x84,0x82,0x82,0x91,0xE4,0xA9,0x81,0x82,0x86,0x82,0xFF,0x00,0x00,
0x00,0x80,0x60,0x1F,0x00,0x00,0xFF,0x00,0x08,0x84,0x42,0x21,0x11,0x1C,0x08,0x00,
0x00,0x80,0x60,0x0F,0x24,0xC4,0x04,0x14,0x24,0xC4,0x04,0x1F,0x20,0xC0,0x00,0x00,
0xFF,0x00,0x04,0x08,0x07,0x09,0x09,0x09,0x09,0xFF,0x09,0x09,0x09,0x09,0x08,0x00,
0x08,0x08,0xFE,0x01,0x02,0x01,0xFF,0x82,0x43,0x24,0x19,0x36,0xC3,0x80,0x80,0x00,
0x00,0xFE,0x4A,0x4A,0x4A,0x4A,0xFE,0x00,0x00,0xFE,0x4A,0x4A,0x4A,0x4A,0xFE,0x00,
0x06,0x01,0xFF,0x00,0x01,0x08,0x0B,0x8A,0x6A,0x1E,0x2A,0x4A,0xCB,0x88,0x88,0x00,
0x10,0x30,0x1F,0x08,0x0A,0x82,0x62,0x1A,0x07,0x0A,0x12,0x22,0x63,0xC2,0x42,0x00,
0x30,0x11,0x10,0xF0,0x10,0x10,0x30,0x00,0x10,0xF0,0x10,0x10,0xD0,0x11,0x20,0x00,
0x11,0xF0,0x10,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x80,0x80,0x00,0x00,0x00,
0x00,0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0xE0,0x10,0x10,0x10,0x10,0xE0,0x00,
0x01,0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xC0,0x21,0x10,0x10,0x30,0x01,0x00,0x00,0xE0,0x10,0x10,0x10,0x11,0xE0,0x00,
0x00,0xC0,0x20,0x10,0x10,0x30,0x00,0x00,0x00,0x20,0x20,0xF0,0x00,0x00,0x00,0x00,
0x00,0xC0,0x21,0x10,0x10,0x21,0xC1,0x00,0x00,0x00,0x80,0x40,0x20,0xF1,0x00,0x00,
0x00,0x60,0x10,0x10,0x11,0x90,0x60,0x00,0x00,0x70,0x10,0x10,0x90,0x70,0x10,0x00,
0x00,0x00,0x40,0x7F,0x40,0x00,0x00,0x00,0x40,0x7F,0x41,0x41,0x47,0x40,0x30,0x00,
0x40,0x7F,0x40,0x40,0x40,0x40,0x60,0x00,0x00,0x00,0x00,0x61,0x61,0x00,0x00,0x00,
0x00,0x1F,0x20,0x40,0x40,0x20,0x1F,0x00,0x00,0x60,0x50,0x48,0x44,0x43,0x60,0x00,
0x00,0x1F,0x20,0x40,0x40,0x20,0x1F,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
0x00,0x1F,0x22,0x41,0x41,0x22,0x1C,0x00,0x00,0x60,0x50,0x48,0x44,0x43,0x60,0x00,
0x00,0x1F,0x22,0x41,0x41,0x22,0x1C,0x00,0x00,0x40,0x40,0x7F,0x40,0x40,0x00,0x00,
0x00,0x01,0x62,0x44,0x44,0x22,0x1F,0x00,0x00,0x0E,0x09,0x48,0x48,0x7F,0x48,0x00,
0x00,0x30,0x40,0x41,0x41,0x22,0x1C,0x00,0x00,0x00,0x00,0x7E,0x01,0x00,0x00,0x00,
};

/*---------------延时子程序----------------*/
void delay (uint us)
{
  while(us--);
}
void delay1 (uint ms)
{
  uint i,j;
  for(i=0;i<ms;i++)
  for(j=0;j<1000;j++)
  ;
}
/*------------写数据或命令到LCD--------------*/
void wr_lcd (uchar dat_comm,uchar content)
{
  chk_busy ();
  rs=dat_comm;
  rw=0;
  data_ora=content;
  e=1;
  ;
  e=0;
}
/*--------------读LCD数据---------------*/
uchar rd_lcd ()
{
  uchar rddata;
  chk_busy ();
  rs=1;
  rw=1;
  e=1;
  ;
  rddata=data_ora;
  e=0;
  return rddata;
}
void chk_busy (void)
{
  data_ora=0xff;
  rs=0;
  rw=1;
  ;
  e=1;
  while(bf||res==1);
  e=0;
}
/*--------------写点阵------------------*/
void lat_disp (uchar data1,uchar data2)
{
  uchar i,j;
  cs1=1;cs2=1;
  wr_lcd (comm,disp_on);
  for(j=0;j<8;j++)
  {
    wr_lcd (comm,disp_x+j);
    wr_lcd (comm,disp_z);
    wr_lcd (comm,disp_y);
    for(i=0;i<32;i++)
    {
      wr_lcd (dat,data1);
      wr_lcd (dat,data2);
    }
  }
}
/*--------------显示图片----------------*/
void img_disp (uchar code *img)
{
  uchar i,j;
  for(j=0;j<8;j++)
  {
    cs1=1;cs2=0;
    wr_lcd (comm,disp_on);
    wr_lcd (comm,disp_x+j);
    wr_lcd (comm,disp_z);
    wr_lcd (comm,disp_y);
    for(i=0;i<64;i++)
      wr_lcd (dat,img[j*128+i]);
    cs1=0;cs2=1;
    wr_lcd (comm,disp_on);
    wr_lcd (comm,disp_x+j);
    wr_lcd (comm,disp_z);
    wr_lcd (comm,disp_y);
    for(i=64;i<128;i++)
      wr_lcd (dat,img[j*128+i]);
  }
}
/*---指定位置(x,y)显示row_xl行(每行row_yl个)汉字(大小8xl*yl)---*/
void chn_disp (uchar x,uchar y,uchar xl,uchar yl,uchar row_xl,uchar row_yl,uchar code *chn)
{
  uchar i,j,k,l,a;
  wr_lcd (comm,disp_on);
  for(l=0;l<row_xl;l++)
  {
    for(k=0;k<row_yl;k++)
    {
      for(j=0;j<xl;j++)
      {
        wr_lcd (comm,disp_x+x+l*xl+j);
        wr_lcd (comm,disp_z);
        wr_lcd (comm,disp_y+y+k*yl);
        a=l*xl*yl*row_yl+k*xl*yl+j*yl;
        for(i=0;i<yl;i++)
          wr_lcd (dat,chn[a+i]);
      }
    }
  }
}
/*------------------初始化-----------------*/
void init_lcd (void)
{
  rst=0;
  delay(50);
  rst=1;
  cs1=1;cs2=1;
  wr_lcd (comm,disp_off);
  wr_lcd (comm,disp_on);
}

/*------------------主程序--------------------*/
void main ()
{
  init_lcd ();
  while (1)
  {
    img_disp(pic1);
    delay1 (400);
    lat_disp (0xff,0x00);
    delay1(400);
    lat_disp (0x33,0x33);
    delay1 (400);
    img_disp(pic2);
    delay1 (400);
  }
}

使用特权

评论回复
10
zero-minmin| | 2013-4-10 22:06 | 只看该作者
你的主函数部分是写错了,你的a1[]中的值有32个,你的for循环中只有16个,字是显示不全。改下你的主函数。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

7

主题

84

帖子

0

粉丝