瓶阀厂家
免费服务热线

Free service

hotline

010-00000000
瓶阀厂家
热门搜索:
技术资讯
当前位置:首页 > 技术资讯

不带字库的12864液晶汉字显示程序

发布时间:2020-07-21 19:27:09 阅读: 来源:瓶阀厂家

下面是线路连接图,我自己已经搞了整整一个测试成功了绝对可用由于篇幅有限完整的c51代码下载:

源代码:#includereg52.h>#define LCD P0unsigned char i,j,k;sbit EN=P2^0;sbit RW=P2^1;sbit RS=P2^2;sbit CS1=P2^3;sbit CS2=P2^4;sbit BUSY=P0^0;void delay(unsigned char a);unsigned char code ban[16][16]={{0x00,0x00,0x00,0xf0,0x90,0x90,0x90,0xfe,0x90,0x90,0x90,0xf0,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x07,0x04,0x04,0x04,0x3f,0x24,0x24,0x24,0x27,0x20,0x38,0x00,0x00},//电{0x00,0x00,0x00,0x00,0x8c,0x88,0x88,0x88,0x88,0xc8,0xa8,0x98,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x21,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//子{0x00,0x00,0x00,0x00,0x10,0x10,0x30,0x54,0x9c,0x90,0x50,0x00,0x30,0x10,0x00,0x00},{0x00,0x40,0x30,0x0c,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00},//产{0x00,0x00,0x00,0x00,0x7c,0x44,0x44,0x44,0x44,0x44,0x44,0x7c,0x00,0x00,0x00,0x00},{0x00,0x00,0x3f,0x21,0x21,0x21,0x3f,0x00,0x00,0x3f,0x21,0x21,0x21,0x3f,0x00,0x00},//品{0x00,0x00,0x00,0x00,0x0c,0x08,0x08,0x08,0xf8,0x08,0x08,0x08,0x08,0x00,0x00,0x00},{0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x3f,0x20,0x20,0x20,0x20,0x30,0x00,0x00},//工{0x00,0x90,0x90,0x88,0xf8,0x84,0x86,0x00,0x7c,0x44,0x44,0x44,0x44,0x7c,0x00,0x00},{0x40,0x30,0x0c,0x02,0x7f,0x02,0x0c,0x10,0x49,0x49,0x49,0x7f,0x49,0x49,0x00,0x00},//程{0x00,0x10,0x10,0x10,0xfc,0x90,0x10,0x00,0xd0,0x50,0x50,0x7e,0x50,0xd0,0x50,0x00},{0x04,0x08,0x04,0x22,0x7f,0x00,0x40,0x20,0x10,0x09,0x06,0x06,0x09,0x10,0x20,0x40},//技{0x00,0x00,0x10,0x10,0x10,0xd0,0x10,0xfe,0x10,0x50,0x94,0x1c,0x10,0x00,0x00,0x00},{0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x7f,0x00,0x00,0x00,0x03,0x04,0x18,0x60,0x00},//术 };unsigned char code qrs[6][16]={{0x00,0x00,0xbc,0xe0,0xa0,0xa0,0xe0,0xa0,0x3f,0xa0,0x60,0x20,0x20,0x3c,0x00,0x00},{0x00,0x00,0x00,0x3f,0x24,0x24,0x3f,0x22,0x11,0x09,0x05,0x07,0x09,0x13,0x20,0x00},//嵌{0x00,0x00,0x00,0x00,0x02,0x04,0xc8,0x30,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00},{0x00,0x40,0x20,0x18,0x06,0x01,0x00,0x00,0x00,0x00,0x00,0x03,0x06,0x0c,0x30,0x00},//入--{0x00,0x00,0x00,0x20,0xa0,0xa0,0xa0,0xa0,0xa2,0xa4,0x38,0xe0,0x24,0x2c,0x00,0x00},{0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x0f,0x09,0x04,0x04,0x00,0x07,0x18,0x20,0x00},//式};checkbusy(){ EN=1;RW=1;RS=0;LCD=0XFF;if(BUSY);}writecode(unsigned char dat) //写命令{ checkbusy();EN=1;RW=0;RS=0;LCD=dat;EN=1;EN=0;}writedata(unsigned char dat) //写数据{ checkbusy();EN=1;RW=0;RS=1;LCD=dat;EN=1;EN=0;}void displayhanzi(unsigned char page,unsigned char lineaddress,int n, unsigned char table[][16]){unsigned char temp[32];if(lineaddress0X80){CS1=1;CS2=0;}//leftfor(j=0;jn;j++){ if(lineaddress>=0X80){CS1=0;//rightCS2=1;lineaddress=lineaddress-0X40;}////////////////////////////////////////for(k=0;k16;k++){temp[k]=table[j][k];}j+=1;for(k=0;k16;k++){temp[16+k]=table[j][k];} //一个字:占两个字符,32个数据(temp[32])///////////////////////////////////////writecode(page);writecode(lineaddress);for(i=0;i16;i++){ writedata(temp[i]);}writecode(page+1);writecode(lineaddress);for(i=16;i32;i++){ writedata(temp[i]);} //写一个字:每页16个数据////////////////////////////////////////////////lineaddress+=16;delay(200);}}void clear(){unsigned char b=0x40,c,d;for(c=0;c4;c++){for(a=0;a8;a++){switch(c){case 0:d=0xb8;break;case 1:d=0xba;break;case 2:d=0xbc;break;default:d=0xbe;}displayhanzi(d,b,2,lin);b+=0x10;} b=0x40; }}void lcdinti(){ writecode(0X3f);//显示开关关writecode(0XC0);//修改显示起始行writecode(0XB8);//修改页地址,x地址writecode(0X40);//修改列地址,y地址}void delay(unsigned char a){unsigned char i,j;for(i=0;ia;i++)for(j=0;j200;j++);}main(){ lcdinti();clear();while(1){displayhanzi(0XB8,0X40,12,xx);displayhanzi(0XBa,0X40,16,ban);displayhanzi(0XBc,0X60,6,zjy);displayhanzi(0XBe,0X60,6,qrs);delay(200);clear();displayhanzi(0XB8,0X40,12,xx);displayhanzi(0XBa,0X40,16,ban);displayhanzi(0XBc,0X60,4,sg);displayhanzi(0XBe,0X60,6,qrs);delay(200);clear();displayhanzi(0XB8,0X40,12,xx);displayhanzi(0XBa,0X40,16,ban);displayhanzi(0XBc,0X60,6,qrs);displayhanzi(0XBe,0X60,8,jqyk); delay(200);delay(200);delay(200);delay(200);delay(200);delay(200);delay(200);delay(200);clear();}}汇编源代码:完整代码下载: 0100HEN BIT 0A0H ;sbit EN=P2^0; RW BIT 0A1H ;sbit RW=P2^1;RS BIT 0A2H ;sbit RS=P2^2;CS1 BIT 0A3H ;sbit CS1=P2^3;CS2 BIT 0A4H BUS BIT 80HSTART:CLR CS1CLR CS2 CALL INITCALL CLEARCALL HANZI SJMP $WRITEDATA: ;入口参数R1PUSH PSWPUSH ACCSETB ENCLR RWSETB RSNOPMOV P0,R1 NOP SETB ENNOPNOPCLR ENPOP ACCPOP PSWRETWRITECODE: ;入口参数R2PUSH PSWPUSH ACCSETB ENCLR RWCLR RSNOPMOV P0,R2NOPSETB ENNOPNOPCLR ENPOP ACCPOP PSWRETDELAY: ;入口参数R2PUSH PSWPUSH ACCMOV R1,0FFH A2: DEC R2 A1: DEC R1 DJNZ R1,A1DJNZ R2,A2POP ACCPOP PSWRETINIT:PUSH PSWPUSH ACCMOV R2,0C0HCALL WRITECODEMOV R2,3FHCALL WRITECODEMOV R2,0BBHCALL WRITECODEMOV R2,50HCALL WRITECODEPOP ACCPOP PSWRETCLEAR:PUSH PSWPUSH ACCCLR CS1CLR CS2MOV R2,0B8HB2:MOV 31H,R2PUSH 31H CALL WRITECODEMOV R2,40HCALL WRITECODEB1: MOV R1,#00HCALL WRITEDATA INC R2CJNE R2,#80H,B1POP 31HINC 31HMOV R2,31H CJNE R2,#0BEH,B2 POP ACCPOP PSW RET HANZI:PUSH PSWPUSH ACCCALL INITANL A,#00HMOV DPTR,#DATB3:MOVC A,@A+DPTRMOV R1,A CALL WRITEDATA INC R2INC ACJNE R2,#50H,B3MOV R2,0B9HCALL WRITECODEMOV R2,40HCALL WRITECODEB4:MOVC A,@A+DPTRMOV R1,A CALL WRITEDATAINC R2INC ACJNE R2,#50H,B4POP ACCPOP PSWRETDAT:DB 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01DB 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01 END

c++相关文章:c++教程

福州隆胸价格

南京双眼皮价格

广州隆鼻医院

相关阅读