LCD128x64液晶Proteus仿真---AT89C52(并口)proteus2010-04-0720:05:40阅读16评论0字号:大中小/****************由龙丘科技开发板程序改写************************/#includeAT89X52.H//52系列单片机定义文件#includeintrins.h//调用_nop_();延时函数用#defineLCD_Data_OutP3sbitRW=P1^0;sbitRS=P1^1;sbitRST=P1^2;sbitCS=P1^3;sbitE=P1^4;#defineX_WIDTH132#defineY_WIDTH64#definebyteunsignedchar//无符号字符(8位)#defineuintunsignedint//无符号整数(16位)voidLCD_Init(void);voidLCD_CLS(void);voidLCD_P6x8Str(bytex,bytey,bytech[]);voidLCD_P8x16Str(bytex,bytey,bytech[]);voidLCD_P14x16Str(bytex,bytey,bytech[]);voidLCD_Print(bytex,bytey,bytech[]);voidLCD_PutPixel(bytex,bytey);voidLCD_Rectangle(bytex1,bytey1,bytex2,bytey2,bytegif);voidDraw_LQLogo(void);voidDraw_LibLogo(void);voidDraw_BMP(bytex0,bytey0,bytex1,bytey1,bytebmp[]);voidLCD_WrDat(bytedate);voidLCD_WrCmd(bytecmd);voidLCD_Fill(bytebmp_data);voidLCD_Set_Pos(bytex,bytey);//*************************建立数字库*********************codebyteF6x8[][6]={{0x00,0x3E,0x51,0x49,0x45,0x3E},//0{0x00,0x00,0x42,0x7F,0x40,0x00},//1{0x00,0x42,0x61,0x51,0x49,0x46},//2{0x00,0x21,0x41,0x45,0x4B,0x31},//3{0x00,0x18,0x14,0x12,0x7F,0x10},//4{0x00,0x27,0x45,0x45,0x45,0x39},//5{0x00,0x3C,0x4A,0x49,0x49,0x30},//6{0x00,0x01,0x71,0x09,0x05,0x03},//7{0x00,0x36,0x49,0x49,0x49,0x36},//8{0x00,0x06,0x49,0x49,0x29,0x1E},//9{0x00,0x00,0x36,0x36,0x00,0x00},//:{0x00,0x00,0x56,0x36,0x00,0x00},//;{0x00,0x08,0x14,0x22,0x41,0x00},//{0x00,0x14,0x14,0x14,0x14,0x14},//={0x00,0x00,0x41,0x22,0x14,0x08},//{0x00,0x02,0x01,0x51,0x09,0x06},//?{0x00,0x32,0x49,0x59,0x51,0x3E},//@{0x00,0x7C,0x12,0x11,0x12,0x7C},//A{0x00,0x7F,0x49,0x49,0x49,0x36},//B{0x00,0x3E,0x41,0x41,0x41,0x22},//C{0x00,0x7F,0x41,0x41,0x22,0x1C},//D{0x00,0x7F,0x49,0x49,0x49,0x41},//E{0x00,0x7F,0x09,0x09,0x09,0x01},//F{0x00,0x3E,0x41,0x49,0x49,0x7A},//G{0x00,0x7F,0x08,0x08,0x08,0x7F},//H{0x00,0x00,0x41,0x7F,0x41,0x00},//I{0x00,0x20,0x40,0x41,0x3F,0x01},//J{0x00,0x7F,0x08,0x14,0x22,0x41},//K{0x00,0x7F,0x40,0x40,0x40,0x40},//L{0x00,0x7F,0x02,0x0C,0x02,0x7F},//M{0x00,0x7F,0x04,0x08,0x10,0x7F},//N{0x00,0x3E,0x41,0x41,0x41,0x3E},//O{0x00,0x7F,0x09,0x09,0x09,0x06},//P{0x00,0x3E,0x41,0x51,0x21,0x5E},//Q{0x00,0x7F,0x09,0x19,0x29,0x46},//R{0x00,0x46,0x49,0x49,0x49,0x31},//S{0x00,0x01,0x01,0x7F,0x01,0x01},//T{0x00,0x3F,0x40,0x40,0x40,0x3F},//U{0x00,0x1F,0x20,0x40,0x20,0x1F},//V{0x00,0x3F,0x40,0x38,0x40,0x3F},//W{0x00,0x63,0x14,0x08,0x14,0x63},//X{0x00,0x07,0x08,0x70,0x08,0x07},//Y{0x00,0x61,0x51,0x49,0x45,0x43},//Z{0x00,0x00,0x7F,0x41,0x41,0x00},//[{0x00,0x55,0x2A,0x55,0x2A,0x55},//55{0x00,0x00,0x41,0x41,0x7F,0x00},//]{0x00,0x04,0x02,0x01,0x02,0x04},//^{0x00,0x40,0x40,0x40,0x40,0x40},//_{0x00,0x00,0x01,0x02,0x04,0x00},//'{0x00,0x20,0x54,0x54,0x54,0x78},//a{0x00,0x7F,0x48,0x44,0x44,0x38},//b{0x00,0x38,0x44,0x44,0x44,0x20},//c{0x00,0x38,0x44,0x44,0x48,0x7F},//d{0x00,0x38,0x54,0x54,0x54,0x18},//e{0x00,0x08,0x7E,0x09,0x01,0x02},//f{0x00,0x18,0xA4,0xA4,0xA4,0x7C},//g{0x00,0x7F,0x08,0x04,0x04,0x78},//h{0x00,0x00,0x44,0x7D,0x40,0x00},//i{0x00,0x40,0x80,0x84,0x7D,0x00},//j{0x00,0x7F,0x10,0x28,0x44,0x00},//k{0x00,0x00,0x41,0x7F,0x40,0x00},//l{0x00,0x7C,0x04,0x18,0x04,0x78},//m{0x00,0x7C,0x08,0x04,0x04,0x78},//n{0x00,0x38,0x44,0x44,0x44,0x38},//o{0x00,0xFC,0x24,0x24,0x24,0x18},//p{0x00,0x18,0x24,0x24,0x18,0xFC},//q{0x00,0x7C,0x08,0x04,0x04,0x08},//r{0x00,0x48,0x54,0x54,0x54,0x20},//s{0x00,0x04,0x3F,0x44,0x40,0x20},//t{0x00,0x3C,0x40,0x40,0x20,0x7C},//u{0x00,0x1C,0x20,0x40,0x20,0x1C},//v{0x00,0x3C,0x40,0x30,0x40,0x3C},//w{0x00,0x44,0x28,0x10,0x28,0x44},//x{0x00,0x1C,0xA0,0xA0,0xA0,0x7C},//y{0x00,0x44,0x64,0x54,0x4C,0x44},//z};codebyteF14x16_Idx[]={科技};codebyteF14x16[]={0x24,0x24,0xA4,0xFE,0xA2,0x22,0x00,0x24,0x48,0x00,0xFE,0x80,0x80,0x00,0x04,0x03,0x00,0x3F,0x00,0x01,0x01,0x01,0x01,0x01,0x3F,0x00,0x00,0x00,//科20x10,0x10,0xFE,0x90,0x10,0x48,0xC8,0x48,0x7E,0x48,0x48,0xC8,0x08,0x00,0x12,0x21,0x1F,0x00,0x20,0x20,0x11,0x0A,0x04,0x0A,0x11,0x20,0x20,0x00,//技3};//************************延时******************************voidLCD_DLY_ms(uintms){intii,jj;if(ms1)ms=1;for(ii=0;iims;ii++)for(jj=0;jj2670;jj++);//busclk:16MHz--1ms}/**********************主函数*******************************/main(){LCD_Init();//LCD初始化while(1){LCD_P6x8Str(0,3,zjwind@163com);//输出字符,利用ASCLL码/*LCD_P6x8Str(0,1,1);//输出字符,利用ASCLL码LCD_P6x8Str(0,2,2);//输出字符,利用ASCLL码LCD_P6x8Str(0,3,3);//输出字符,利用ASCLL码LCD_P6x8Str(0,4,4);//输出字符,利用ASCLL码LCD_P6x8Str(0,5,5);//输出字符,利用ASCLL码LCD_P6x8Str(0,6,6);//输出字符,利用ASCLL码LCD_P6x8Str(0,7,7);//输出字符,利用ASCLL码*/LCD_Print(0,0,科技);}}/***************************LCD12864************************///**************************写命令**************************voidLCD_WrCmd(bytecmd)//写命令{RS=0;CS=0;RW=0;E=1;P3=cmd;_nop_();E=0;}//**************************写数据**************************voidLCD_WrDat(bytedate)//--写数据{RS=1;CS=0;RW=0;E=1;P3=date;_nop_();E=0;}//************************清屏*****************************voidLCD_Fill(bytebmp_data){bytey,x;for(y=0;y8;y++)//分页,总共8页{LCD_WrCmd(0xb0+y);//设置页地址LCD_WrCmd(0x01);//设置column地址低地址LCD_WrCmd(0x10);//设置column地址高地址for(x=0;xX_WIDTH;x++)LCD_WrDat(bm