基于12864液晶的程序代码显示本人姓名及专业
    




#include"reg51.h"
#define uchar unsigned char
#define uint unsigned int
sbit lcdrst=P3^0;
sbit cs2=P3^5;
sbit cs1=P3^4;
sbit e=P3^2;
sbit rw=P3^3;
sbit rs=P3^1;
uchar code liu[]={0x00,0x08,0x28,0x49,0x8A,0x0C,0xC8,0x38,0x08,0x00,0xF8,0x00,0x00,0xFF,0x00,0x00,
0x40,0x20,0x10,0x08,0x04,0x03,0x06,0x38,0x10,0x00,0x07,0x20,0x40,0x3F,0x00,0x00};
uchar code xiao[]={0x08,0x88,0x68,0xFF,0x28,0x48,0x00,0x88,0x68,0x09,0x0E,0x08,0xA8,0x48,0x88,0x00,
0x02,0x01,0x00,0xFF,0x00,0x40,0x42,0x21,0x26,0x18,0x18,0x26,0x61,0xC0,0x40,0x00};
uchar code jun[]={0x00,0x18,0x26,0x22,0xA2,0x72,0x2E,0xAA,0x22,0x22,0x22,0x32,0x22,0x0A,0x06,0x00,
0x00,0x10,0x10,0x12,0x13,0x12,0x12,0xFF,0x12,0x12,0x12,0x13,0x12,0x18,0x10,0x00};
uchar code dian[]={0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00,
0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00};
uchar code zi[]={0x00,0x00,0x02,0x02,0x02,0x02,0x02,0xE2,0x12,0x0A,0x06,0x02,0x00,0x80,0x00,0x00,
0x01,0x01,0x01,0x01,0x01,0x41,0x81,0x7F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00};
uchar code xin[]={0x80,0x40,0x30,0xFC,0x07,0x0A,0xA8,0xA8,0xA9,0xAE,0xAA,0xA8,0xA8,0x08,0x08,0x00,
0x00,0x00,0x00,0x7F,0x00,0x00,0x7E,0x22,0x22,0x22,0x22,0x22,0x7E,0x00,0x00,0x00};
uchar code xi[]={0x00,0x00,0x00,0xFC,0x54,0x54,0x56,0x55,0x54,0x54,0x54,0xFC,0x00,0x00,0x00,0x00,
0x00,0x20,0x38,0x01,0x3D,0x41,0x41,0x45,0x59,0x41,0x41,0x71,0x00,0x08,0x30,0x00};
uchar code gong[]={0x00,0x00,0x02,0x02,0x02,0x02,0x02,0xFE,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00};
uchar code cheng[]={0x10,0x12,0xD2,0xFE,0x91,0x11,0x80,0xBF,0xA1,0xA1,0xA1,0xA1,0xBF,0x80,
0x00,0x00,0x04,0x03,0x00,0xFF,0x00,0x41,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x40,0x00};
uchar code zhuan[]={0x20,0x20,0x24,0x24,0xA4,0x64,0x3C,0x27,0x24,0x24,0xA4,0x24,0x24,0x20,0x20,0x00,
0x00,0x00,0x00,0x00,0x01,0x01,0x09,0x11,0x29,0x45,0x03,0x01,0x00,0x00,0x00,0x00};
uchar code ye[]={0x00,0x10,0x60,0x80,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x80,0x60,0x38,0x10,0x00,
0x20,0x20,0x20,0x23,0x21,0x3F,0x20,0x20,0x20,0x3F,0x22,0x21,0x20,0x30,0x20,0x00};

uchar code wu[]={0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00};
uchar code er[]={0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00};
uchar code ling[]={0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00};
uchar code kongge[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
uchar code kong[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
/*uchar code xing[]={0x20,0x24,0x2C,0x35,0xE6,0x34,0x2C,0x24,0x00,0xFC,0x24,0x24,0xE2,0x22,0x22,0x00,
0x21,0x11,0x4D,0x81,0x7F,0x05,0x59,0x21,0x18,0x07,0x00,0x00,0xFF,0x00,0x00,0x00};
uchar code de[]={0x00,0xF8,0x8C,0x8B,0x88,0xF8,0x40,0x30,0x8F,0x08,0x08,0x08,0x08,0xF8,0x00,0x00,
0x00,0x7F,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,0x03,0x26,0x40,0x20,0x1F,0x00,0x00};
uchar code yi[]={0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xC0,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
uchar code nian[]={0x40,0x20,0x10,0x0C,0xE3,0x22,0x22,0x22,0xFE,0x22,0x22,0x22,0x22,0x02,0x00,0x00,
0x04,0x04,0x04,0x04,0x07,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x00}; */
uchar code zhu[]={0x08,0x08,0x89,0xCE,0xA8,0x18,0x00,0xFE,0x82,0x82,0x82,0x82,0xFE,0x00,0x00,0x00,
0x02,0x01,0x00,0xFF,0x00,0x83,0x40,0x30,0x0F,0x00,0x00,0x7F,0x80,0x80,0xF0,0x00};
uchar code yuan[]={0x00,0x00,0xFF,0x01,0x01,0x7D,0x55,0x57,0x55,0xD5,0x55,0x55,0x7D,0x01,0x01,0x00,
0x20,0x18,0x07,0x20,0x3A,0x02,0x39,0x40,0x4A,0x57,0x40,0x60,0x01,0x0A,0x30,0x00};
uchar 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};
uchar code jia[]={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};
uchar code jie[]={0x04,0x04,0x44,0x44,0x44,0x5F,0xC4,0x44,0x44,0x44,0x5F,0x44,0xC4,0x04,0x04,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x08,0x10,0x0F,0x00,0x00,0x00};
uchar code ri[]={0x00,0x00,0x00,0xFE,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x3F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,0x00};
uchar code kuai[]={0x70,0x00,0xFF,0x08,0xB0,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0xF8,0x80,0x80,0x00,
0x00,0x00,0xFF,0x00,0x80,0x40,0x30,0x0E,0x01,0x06,0x08,0x30,0x60,0xC0,0x40,0x00};
uchar code le[]={0x00,0x00,0x40,0xFC,0x44,0x44,0x44,0x46,0xFA,0x42,0x43,0x43,0x42,0x40,0x00,0x00,
0x00,0x20,0x18,0x0C,0x07,0x12,0x20,0x40,0x3F,0x00,0x00,0x02,0x0C,0x38,0x10,0x00};
void delay(uchar z)
{
uchar i,j;
for(i=z;i>0;i--)
for(j=110;j>0;j--);
}
void checkbusy()
{
uchar dat;
rs=0; //数据\指令选择
rw=1; //允许读
do
{
P2=0x00; //清零P2口
delay(5);
e=1;
dat=P2; //读P2口
e=0;
dat>>=7; //仅当第7位为0时才可操作(判别busy信号)
}
while(!(dat==0x00));
}
void write_com(uchar com)
{
checkbusy(); //检查是否忙
rs=0; //写命令
rw=0;
P2=com;
e=1;
e=0;
}
void write_data(uchar date)
{
checkbusy(); //检查是否忙
rs=1; //写数据
rw=0;
P2=date;
e=1;
e=0;
}
void hanzi(uchar ye,uchar lie,uchar *daima)
{
uchar i,j;
for(i=0;i<2;i++)
{
write_com(0xb8+ye+i); // ye页与 ye+1页
write_com(0x40+lie); //确定初始行
for(j=0;j<16;j++)
{
write_data(daima[i*16+j]); //写数据(汉字)
}
}
}
void shuzi(uchar ye,uchar lie,uchar *daima)
{
uchar i,j;
for(i=0;i<2;i++)
{
write_com(0xb8+ye+i); // ye页与 ye+1页
write_com(0x40+lie); //确定初始行
for(j=0;j<8;j++)
{
write_data(daima[i*8+j]); //写数据(数字)
}
}
}
void clearlcd()
{
uchar i,j;
cs1=0; //清全屏 有cs1=0 cs2=0 与无 cs1=0 cs2=0 效果不同
cs2=0;
for(i=0;i<8;i++)
{
write_com(0xb8+i);
write_com(0x40);
for(j=0;j<64;j++)
write_data(0x00);
}
}
void init()
{
write_com(0x3e); //关显示
delay(1);
write_com(0x3f); //开显示
write_com(0xc0); //行初始地址
write_com(0xb8); //页初始地址
write_com(0x40); //列初始地址
}
void display()
{
cs1=0; //左半屏 cs1=0 cs2=1
cs2=1;
hanzi(0,0,liu);
hanzi(0,16,xiao);
hanzi(0,32,jun);
hanzi(0,48,dian);
cs1=1; //右半屏 cs1=1 cs2=0
cs2=0;
hanzi(0,0,zi);
hanzi(0,16,xin);
//hanzi(0,32,kongge); // 如果清屏时加上cs1=0 cs2=0则可以不用,否则要加上
//hanzi(0,48,kongge);
cs1=0;
cs2=1;
hanzi(2,0,xi);
hanzi(2,16,gong);
hanzi(2,32,cheng);
hanzi(2,48,zhuan);
cs1=1;
cs2=0;
hanzi(2,0,ye);
//hanzi(2,16,wang);
//hanzi(2,32,kongge);
//hanzi(2,48,kongge);
cs1=0;
cs2=1;
shuzi(4,0,wu);
shuzi(4,8,er);
shuzi(4,16,ling);
//hanzi(4,32,zhu);
hanzi(4,32,zhu);
hanzi(4,48,yuan);
cs1=1;
cs2=0;
hanzi(4,0,da);
shuzi(4,16,jia);
//hanzi(4,24,jia);
//hanzi(4,40,kongge);
shuzi(4,56,kong);
cs1=0;
cs2=1;
//hanzi(6,0,jia);
hanzi(6,0,jie);
hanzi(6,16,ri);
hanzi(6,32,kuai);
hanzi(6,48,le);
cs1=1;
cs2=0;
//hanzi(6,0,kongge);
//hanzi(6,16,kongge);
//hanzi(6,32,kongge);
//hanzi(6,48,kongge);
}
void main()
{
init();
clearlcd();
while(1)
{
display();
}
}

相关阅读
  • 基于HD61202U图形液晶显示模块接口
  • 基于KS0713的SG12864-5C液晶显示模
  • 基于spce061a单片机的mgls12864液
  • 基于DSP的液晶模块的显示原理及实
  • 基于DSP的液晶显示器接口设计及控
  • 基于DSP的液晶模块的显示原理及实
  • 基于HD61202U图形液晶显示模块接口
  • 一种基于dsp控制的液晶显示屏的设
  • 基于T6963c的12864液晶驱动和电路
  • 基于FPGA的液晶显示接口设计
  • 工业液晶屏LCD显示原理及应用
  • 基于W78E516B的液晶显示控制器显示
  • 基于W78E516B的液晶显示控制器显示
  • 医用仪器液晶显示器常见故障诊断及
  • 基于FPGA的液晶显示接口设计
  • 医用仪器液晶显示器常见故障诊断及
  • LED液晶显示器的LED显示器结构及分
  • 解析液晶显示模块的参数及维护要点
  • 基于ARM和TFT6758的液晶显示模块设
  • 【专业工程液晶显示器选购知多少】
  • 液晶显示器电源及高压逆变电路常见
  •  



     
     
         

    收录时间:2016年10月17日 17:50:12 来源:单片机教程网 作者:匿名
    上一篇:Vesa DDC显示器接口  (电脑版  手机版)
     
    创建分享人
    不俟驾而行
    最新问题
     
    喜欢此文章的还喜欢
    Copyright by www.chinabaike.com;All rights reserved. 联系:QQ:469681782