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

发布者:柳絮轻风最新更新时间:2015-03-11 来源: 51hei关键字: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;
}[page]
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();
}
}
关键字:12864液晶  程序代码 引用地址:基于12864液晶的程序代码显示本人姓名及专业

上一篇:基于51单片机串口通信的实时温度
下一篇:8051软核基本速度比较

推荐阅读最新更新时间:2024-03-16 13:54

基于AVR单片机的12864液晶(ks0108)驱动程序及仿真
#include iom16v.h #include avrdef.h #define EN 0 #define RS 1 #define CS1 2 #define CS2 3 unsigned char yang ={ 0xEF,0xFB,0xEF,0xFC,0x2F,0xFF,0x00,0x00,0x6F,0xFF,0xEF,0xDC,0xFF,0xEF,0xBD,0x73, 0x1D,0xBC,0xAD,0xDF,0xB5,0xE7,0x39,0xB8,0xBD,0x7F,0xBF,0xBF,0x3F,0xC0,0xFF,0xFF }; unsigned char ying ={ 0
[单片机]
基于AVR单片机的<font color='red'>12864</font><font color='red'>液晶</font>(ks0108)驱动程序及仿真
ds1302时钟-AVR程序代码
#include #include DS1302.h #include void ds1302_init(void) { PORTX=0x00; DDRX=0x07; } void write_ds1302_byte(unsigned char dat) { unsigned char i; for(i=0;i 8;i++) { SCK=0; IO_out=dat&0x01; dat=dat 1; SCK=1; } } void write_ds1302(unsigned char add,unsigned char dat) { RST=1; delay_u
[单片机]
AMPIRE12864液晶C语言代码
#include iom16v.h #include macros.h #define uchar unsigned char #define uint unsigned int #define RS_H() PORTD|=BIT(4); #define RS_L() PORTD&=~BIT(4); #define RW_H() PORTD|=BIT(5); #define RW_L() PORTD&=~BIT(5); #define E_H() PORTD|=BIT(6); #define E_L() PORTD&=~BIT(6); #define CS1_L() PORTA&=~BIT(6);//左屏 #
[单片机]
AMPIRE<font color='red'>12864</font><font color='red'>液晶</font>C语言代码
无线红外模块-AVR程序代码
#include  #include  #define uint unsigned int  #define uchar unsigned char    // Alphanumeric LCD Module functions #asm    .equ __lcd_port=0x18 ;PORTB #endasm #include      uchar startflag=0,bitnum,irtime,irprosok,irreceok; uchar irdata ,dis ,ircode ;   // External Interrupt 0 service routine interrupt   void ext_int0
[单片机]
GXM12864图形液晶显示模块驱动程序
GXM12864是一种采用低功耗CMOS技术实现的点阵图形LCD模块,内含KS0108B/HD61202控制器,CSA与KS0108B(1)连通!CSB与KS0108B(2)连通!CSA/CSB为01时选通KS0108B(1);为10时选通CSB与KS0108B(2),为其他值时!禁止选通!总线处于高阻状态! 硬件原理为PO口接DB0-DB7的8位双向数据总线! KS0108B 指令集 1:显示开关指令: R/W=0;D/I=0; 开:0X3F; 关:0X3E 2:显示起始行指令:R/W=0;D/I=0;8位数据高2位为1 后6位位起始巷(0-63) 3:页设置指令:R/W=0;D/I=0; 前5位恒定为10111!后三位为页号(
[单片机]
液晶显示模块MGLS12864T在单兵短波数字通信系统中的应用
摘要:在简要地介绍了单兵短波数字通信系统的基础上,给出了MGLS12864T点阵液晶显示模块与第三代数字信号处理器(DSP)TMS320C31的硬件接口电路。介绍了在DSP控制下,用MGLS12864T实现汉字显示的编程技巧和软件开发流程。 关键词:MGLS12864T;DSP;短波;数字通信;液晶显示 1 引言 21世纪的战争以数字化战场为背景,而数字化战场的一个重要特点是信息可以直达单个士兵。采用基于软件无线电体制的设计思想,应用第三代数字信号处理器TMS320C31等器件构成短波自适应调制解调器,并将其和传统的小型短波电台相连接,再通过编写相应的软件程序即可构成可传输数据信息的单兵短波数字电台。而将MGLS12864
[应用]
ucos-ii学习笔记——基于操作系统用串行方式驱动12864液晶
Created  on:  2012-10-17             Author:  zhang  bin   学习笔记 for  ucos-ii MC9S12XS128  lcd12864  ser_2_pin redesigned  by  zhang  bin 2012-10-17 versions :V-0.1 All  Rights  Reserved       液晶的驱动文件ser_12864.h如下:         #ifndef  SER_12864_H_ #define  SER_12864_H_     //设定wr为PA0
[单片机]
单片机红外电视遥控器C51程序代码
//************************************************************** //名称:单片机红外电视遥控器C51程序代码() /*-------------------------------------------------------------- 描述: 一般红外电视遥控器的输出都是用编码后串行数据对38~40kHz的方波进行 脉冲幅度调制而产生的.当发射器按键按下后,即有遥控码发出,所按的键 不同遥控编码也不同。这种遥控码具有以下特征: 采用脉宽调制的串行码,以脉宽为0.565ms、间隔0.56ms、周期为1.125ms的 组合表示二进制的 0 ;以脉宽为0.565m
[单片机]
小广播
添点儿料...
无论热点新闻、行业分析、技术干货……
设计资源 培训 开发板 精华推荐

最新单片机文章
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

换一换 更多 相关热搜器件
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved