您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 12864液晶屏与单片机连接图
Protel制图Protues原理图程序部分:#includereg51.h#defineucharunsignedchar#defineuintunsignedint//sbitdatabus=P1;#definedatabusP1//sbitReset=P3^0;//复位sbitrs=P3^7;//指令数据选择sbite=P3^5;//指令数据控制sbitcs1=P3^3;//左屏幕选择,低电平有效sbitcs2=P3^4;//右屏幕选择sbitwr=P3^6;//读写控制//sbitbusy=P1^7;//忙标志voidSendCommand(ucharcommand);//写指令voidWriteData(uchardat);//写数据voidLcdDelay(uinttime);//延时voidSetOnOff(ucharonoff);//开关显示voidClearScreen(ucharscreen);//清屏voidSetLine(ucharline);//置页地址voidSetColum(ucharcolum);//置列地址voidSetStartLine(ucharstartline);//置显示起始行voidSelectScreen(ucharscreen);//选择屏幕voidShow1616(ucharlin,ucharcolum,uchar*address);//显示一个汉字voidInitLcd();//初始化voidResetLcd();//复位voidShow_english(ucharlin,ucharcolum,uchar*address);constucharcodehzk[]={/*--文字:I--*//*--宋体12;此字体下对应的点阵为:宽x高=8x16--*/0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,/*--文字:--*//*--宋体12;此字体下对应的点阵为:宽x高=8x16--*/0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*--文字:c--*//*--宋体12;此字体下对应的点阵为:宽x高=8x16--*/0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,/*--文字:a--*//*--宋体12;此字体下对应的点阵为:宽x高=8x16--*/0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,/*--文字:n--*//*--宋体12;此字体下对应的点阵为:宽x高=8x16--*/0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,/*--文字:--*//*--宋体12;此字体下对应的点阵为:宽x高=8x16--*/0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*--文字:m--*//*--宋体12;此字体下对应的点阵为:宽x高=8x16--*/0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,/*--文字:a--*//*--宋体12;此字体下对应的点阵为:宽x高=8x16--*/0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,/*--文字:k--*//*--宋体12;此字体下对应的点阵为:宽x高=8x16--*/0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,/*--文字:e--*//*--宋体12;此字体下对应的点阵为:宽x高=8x16--*/0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,/*--文字:--*//*--宋体12;此字体下对应的点阵为:宽x高=8x16--*/0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*--文字:i--*//*--宋体12;此字体下对应的点阵为:宽x高=8x16--*/0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,/*--文字:t--*//*--宋体12;此字体下对应的点阵为:宽x高=8x16--*/0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,/*--文字:!--*//*--宋体12;此字体下对应的点阵为:宽x高=16x16--*/0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*--文字:我--*//*--楷体_GB231212;此字体下对应的点阵为:宽x高=16x16--*/0x00,0x00,0x80,0x90,0xF0,0x48,0x40,0x7F,0xC0,0x20,0x24,0xA8,0x00,0x00,0x00,0x00,0x08,0x08,0x04,0x14,0x3F,0x02,0x09,0x08,0x05,0x06,0x09,0x10,0x20,0x78,0x00,0x00,/*--文字:的--*//*--楷体_GB231212;此字体下对应的点阵为:宽x高=16x16--*/0x00,0xC0,0x60,0x50,0x2C,0xE0,0x80,0x40,0xA0,0x38,0x26,0x10,0xF0,0x00,0x00,0x00,0x00,0x07,0x19,0x09,0x08,0x1F,0x00,0x00,0x00,0x03,0x10,0x20,0x1F,0x00,0x00,0x00,/*--文字:未--*//*--楷体_GB231212;此字体下对应的点阵为:宽x高=16x16--*/0x00,0x00,0x80,0x80,0x90,0x90,0xFF,0xC8,0x48,0x48,0x40,0x40,0x00,0x00,0x00,0x00,0x10,0x10,0x08,0x04,0x02,0x01,0x7F,0x00,0x01,0x02,0x04,0x08,0x18,0x10,0x10,0x00,/*--文字:来--*//*--楷体_GB231212;此字体下对应的点阵为:宽x高=16x16--*/0x00,0x80,0x80,0xA8,0xC8,0x88,0xFF,0x84,0x64,0x54,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x08,0x04,0x02,0x7F,0x01,0x02,0x04,0x0C,0x08,0x08,0x08,0x08,0x00,/*--文字:不--*//*--楷体_GB231212;此字体下对应的点阵为:宽x高=16x16--*/0x00,0x00,0x08,0x08,0x08,0x88,0x48,0xE4,0x14,0x8C,0x84,0x04,0x04,0x04,0x00,0x00,0x00,0x04,0x04,0x02,0x01,0x00,0x00,0x3F,0x00,0x00,0x00,0x01,0x03,0x06,0x00,0x00,/*--文字:是--*//*--楷体_GB231212;此字体下对应的点阵为:宽x高=16x16--*/0x00,0x00,0x80,0x80,0x82,0x9E,0xAA,0xAA,0xA1,0x5D,0x43,0x40,0x00,0x00,0x00,0x00,0x20,0x20,0x10,0x08,0x06,0x04,0x08,0x1F,0x12,0x22,0x22,0x20,0x20,0x20,0x20,0x00,/*--文字:梦--*//*--楷体_GB231212;此字体下对应的点阵为:宽x高=16x16--*/0x00,0x90,0x50,0x30,0xFE,0x28,0x48,0x28,0x18,0xFF,0x14,0x24,0x24,0x40,0x40,0x00,0x00,0x00,0x40,0x48,0x44,0x26,0x2B,0x12,0x0A,0x06,0x00,0x00,0x00,0x00,0x00,0x00,/*--文字:!--*//*--楷体_GB231212;此字体下对应的点阵为:宽x高=16x16--*/0x00,0x00,0x00,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};voidmain(){uchari,line,colum/*,j*/;uchar*address;InitLcd();while(1){/*显示第一行*//**********************************下面这段程序用来卷页**********************************//*line=0;for(j=0;j4;j++){ClearScreen(2);//清屏line=line+1;colum=0;address=hzk;SetOnOff(1);for(i=0;i14;i++){if(i8){SelectScreen(0);Show_english(line,colum,address);address+=16;colum+=8;}elseif(i=8){if(i13){SelectScreen(1);Show_english(line,colum,address);address+=16;colum+=8;}else{Show1616(line,colum,address);address+=32;colum+=16;}}}for(i=0;i50;i++)//延时LcdDelay(3000);}*/line=1;//开始从第2页(第9行)开始显示,colum=0;//开始从第一列开始显示address=hzk;//给地址指针赋初值SetOnOff(1);//显示开,注意:如果这里设置显示关,显示会出现错误for(i=0;i14;i++)//设置要显示的字符个数{if(i8)//i8时,在左半屏显示(因为每半屏最多只能显示8个英文字符即4个汉字){SelectScreen(0);//选择左屏Show_english(line,colum,addre
本文标题:12864液晶屏与单片机连接图
链接地址:https://www.777doc.com/doc-6070828 .html