找回密码
 注册会员
更新自动建库工具PCB Footprint Expert 2024.04 Pro / Library Expert 破解版

菜鸟请教12864程序

[复制链接]
admin 发表于 2012-9-2 12:42:48 | 显示全部楼层 |阅读模式

本文包含原理图、PCB、源代码、封装库、中英文PDF等资源

您需要 登录 才可以下载或查看,没有账号?注册会员

×
#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
sbit EN=P2^0;
sbit RW=P2^1;
sbit RS=P2^2;
sbit CS1=P2^3;
sbit CS2=P2^4;
uchar code Hzk[]={
/*-- 文字: 各 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x20,0x20,0x10,0x08,0x8F,0xB4,0x44,0x44,0xA4,0x9C,0x04,0x00,0x00,0x00,0x00,
0x02,0x02,0x02,0x01,0x7F,0x42,0x42,0x42,0x42,0x42,0x42,0x7F,0x01,0x03,0x01,0x00,

/*-- 文字: 位 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0xC0,0x30,0xEC,0x03,0x2A,0xC8,0x09,0x0A,0x0E,0x08,0xE8,0x48,0x08,0x00,0x00,
0x01,0x00,0x00,0x7F,0x20,0x20,0x20,0x27,0x20,0x30,0x2E,0x21,0x20,0x20,0x20,0x00,

/*-- 文字: 单 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
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,

/*-- 文字: 机 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
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,

/*-- 文字: 爱 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x40,0xB2,0x96,0x9A,0x92,0xF6,0x9A,0x93,0x91,0x99,0x97,0x91,0x90,0x30,0x00,
0x40,0x20,0xA0,0x90,0x4C,0x47,0x2A,0x2A,0x12,0x1A,0x26,0x22,0x40,0xC0,0x40,0x00,

/*-- 文字: 好 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x10,0x10,0xF0,0x1F,0x10,0xF0,0x80,0x82,0x82,0x82,0xF2,0x8A,0x86,0x82,0x80,0x00,
0x80,0x43,0x22,0x14,0x0C,0x73,0x20,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,

/*-- 文字: 者 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x20,0x24,0x24,0x24,0x24,0xA4,0xBF,0x64,0x24,0x34,0x28,0x26,0x24,0x20,0x00,
0x04,0x04,0x04,0x02,0x02,0xFF,0x49,0x49,0x49,0x49,0x49,0x49,0xFF,0x00,0x00,0x00,

/*-- 文字: 你 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x80,0x40,0xF0,0x2C,0x43,0x20,0x98,0x0F,0x0A,0xE8,0x08,0x88,0x28,0x1C,0x08,0x00,
0x00,0x00,0x7F,0x00,0x10,0x0C,0x03,0x21,0x40,0x3F,0x00,0x00,0x03,0x1C,0x08,0x00,

/*-- 文字: 们 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x80,0x40,0xF0,0x1C,0x03,0xF0,0x01,0x0E,0x04,0x00,0x04,0x04,0x04,0xFC,0x00,0x00,
0x00,0x00,0x7F,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x20,0x40,0x3F,0x00,0x00,

/*-- 文字: 辛 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x80,0x84,0x84,0x94,0xA4,0xC4,0x85,0x86,0x84,0xC4,0xA4,0x94,0x84,0x84,0x80,0x00,
0x00,0x04,0x04,0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x00,0x00,0x00,

/*-- 文字: 苦 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x44,0x44,0x44,0x44,0x5F,0x44,0xF4,0x44,0x44,0x5F,0x44,0x44,0x44,0x44,0x00,
0x00,0x00,0x00,0x7E,0x22,0x22,0x22,0x23,0x22,0x22,0x22,0x7E,0x00,0x00,0x00,0x00,

/*-- 文字: 了 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x02,0x02,0x02,0x02,0x02,0x02,0xF2,0x12,0x0A,0x0A,0x06,0x06,0x02,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

/*-- 文字: 希 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x20,0x20,0x30,0x30,0xA9,0x6A,0x3A,0x24,0xE4,0x2A,0x29,0x30,0x20,0x20,0x20,0x00,
0x08,0x04,0x02,0x01,0x3F,0x01,0x01,0x01,0xFF,0x01,0x21,0x61,0x3F,0x00,0x00,0x00,

/*-- 文字: 望 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x04,0x04,0xFC,0x85,0x46,0x24,0x04,0x80,0x7E,0x2A,0x2A,0xAA,0xAA,0xFE,0x00,0x00,
0x00,0x40,0x42,0x4A,0x4A,0x4A,0x4A,0x7E,0x4A,0x4A,0x4A,0x4A,0x4A,0x42,0x40,0x00,

/*-- 文字: 大 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
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,

/*-- 文字: 家 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x18,0x04,0x14,0x94,0x94,0xD5,0xB6,0x14,0x14,0x94,0x04,0x14,0x0C,0x04,0x00,
0x00,0x29,0x29,0x15,0x14,0x4A,0x89,0x44,0x3F,0x06,0x09,0x09,0x10,0x30,0x10,0x00,

/*-- 文字: 能 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x10,0xB8,0x97,0x92,0x90,0x94,0xB8,0x10,0x00,0x7F,0x48,0x48,0x44,0x74,0x20,0x00,
0x00,0xFF,0x0A,0x0A,0x4A,0x8A,0x7F,0x00,0x00,0x3F,0x44,0x44,0x42,0x72,0x20,0x00,

/*-- 文字: 多 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x00,0x20,0x90,0x88,0x54,0x53,0xA2,0x22,0x12,0x0A,0x06,0x00,0x00,0x00,
0x00,0x81,0x89,0x89,0x44,0x44,0x42,0x25,0x29,0x11,0x11,0x09,0x05,0x03,0x01,0x00,

/*-- 文字: 多 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x00,0x20,0x90,0x88,0x54,0x53,0xA2,0x22,0x12,0x0A,0x06,0x00,0x00,0x00,
0x00,0x81,0x89,0x89,0x44,0x44,0x42,0x25,0x29,0x11,0x11,0x09,0x05,0x03,0x01,0x00,

/*-- 文字: 交 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x08,0x88,0x48,0x38,0x28,0x09,0x0E,0x0C,0x08,0x98,0x28,0x68,0x48,0x08,0x00,
0x00,0x80,0x80,0x40,0x41,0x22,0x14,0x18,0x0C,0x16,0x23,0x61,0xC0,0x40,0x00,0x00,

/*-- 文字: 流 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x10,0x60,0x01,0x86,0x60,0x04,0x44,0x64,0x55,0x4E,0x44,0x64,0xC4,0x04,0x04,0x00,
0x04,0x04,0xFC,0x03,0x40,0x30,0x0F,0x00,0x00,0x7F,0x00,0x3F,0x40,0x40,0x70,0x00,

/*-- 文字: 学 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
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,

/*-- 文字: 习 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x02,0x02,0x0A,0x12,0x22,0x62,0x02,0x82,0x82,0x42,0x02,0xFE,0x00,0x00,
0x00,0x00,0x04,0x0C,0x04,0x02,0x02,0x01,0x01,0x00,0x20,0x40,0x80,0x7F,0x00,0x00,

/*-- 文字: 24 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};


/****************************************/
/* 定义ASCII字库8列*16行 */
/****************************************/
uchar code Ezk[]={

/*-- 文字: Q --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,

/*-- 文字: Q --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,

/*-- 文字: 3 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,

/*-- 文字: 4 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,

/*-- 文字: 5 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,

/*-- 文字: 4 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,

/*-- 文字: 1 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,

/*-- 文字: 5 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,

/*-- 文字: 2 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,

/*-- 文字: 4 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,

/*-- 文字: 4 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,


/*-- 文字: --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

/*-- 文字: --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

/*-- 文字: --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 楼主| admin 发表于 2012-9-2 12:42:51 | 显示全部楼层
0x00,0x00,0x00,0x00,0x00,0x00,

/*-- 文字: --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

/*-- 文字: --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

/*-- 文字: --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

};
void delay(uchar x)
{
uint y;
while(x--)
for(y=110;y>0;y--);
}
void check()
{
uchar temp;
RS=0;
RW=1;
do
{
P0=0x00;
EN=1;
EN=0;
temp=P0;
temp&=0x80;
}
while(temp);
}
void wr_com(uchar com)
{
check();
RS=0;
RW=1;
P0=com;
EN=1;
EN=0;
}
void wr_dat(uchar dat)
{
check();
RS=1;
RW=0;
P0=dat;
EN=1;
EN=0;
}
void setpage(uchar page)
{
page=0xb8|page;
wr_com(page);
}
void setline(uchar line)
{
line=0xc0|line;
wr_com(line);
}
void setcolumn(uchar column)
{
column=column&0x3f;
column=0x40|column;
wr_com(column);
}
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;
}
}
void setonoff(uchar onoff)
{
onoff=0x3e|onoff;
wr_com(onoff);
}
void clearscreen()
{
uchar x,y;
selectscreen(0);
for(x=0;x<8;x++)
{
setpage(x);
setcolumn(0);
for(y=0;y<64;y++)
wr_dat(0x00);
}
}
void init()
{
selectscreen(0);
setonoff(0);
selectscreen(0);
setonoff(1);
clearscreen();
setline(0);
}
void hz(uchar ss,uchar p,uchar col,uchar num)
{
uchar i;
selectscreen(ss);
setline(p);
setcolumn(col);
for(i=0;i<16;i++)
wr_dat(Hzk[num*32+i]);
setline(p+1);
setcolumn(col);
for(i=0;i<16;i++)
wr_dat(Hzk[num*32+i+16]);
}
void main()
{
init();
// hz(2,0,0*16,0);//
/*hz(2,0,1*16,1);//
hz(2,0,2*16,2);//
hz(2,0,3*16,3);//
hz(1,0,4*16,4);//
hz(1,0,5*16,5);//
hz(1,0,6*16,6);//*/
while(1);
}

初始化了之后,显示屏下半部分还是没有清屏,帮看下错在哪里,谢谢!
*滑块验证:
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

QQ|手机版|MCU资讯论坛 ( 京ICP备18035221号-2 )|网站地图

GMT+8, 2024-11-24 23:40 , Processed in 0.053365 second(s), 10 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表