#include
#define LCD P0
unsigned char a,i,j,k;
int b;
sbit EN=P2^0;
sbit RW=P2^1;
sbit RS=P2^2;
sbit CS1=P2^3;
sbit CS2=P2^4;
sbit BUSY=P0^0;
char co
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0xC0,0xC0,0xE0,0xF0,
0xFC,0xFE,0xFC,0xFE,0xFF,0xFE,0xFE,0xFF,
0xFF,0xFC,0xFF,0xFF,0xFE,0xFC,0xFC,0xF8,
0xF0,0xF0,0xF0,0xE0,0xE0,0xC0,0xC0,0x80,
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,0xE0,0xF8,
0xFC,0xFE,0xFF,0xFF,0xFF,0x7F,0x7F,0x7F,
0x7F,0x7F,0x7F,0x3F,0x3F,0x3F,0x3F,0x3F,
0x7F,0x3F,0x7F,0x3F,0x3F,0x3F,0x3F,0x3F,
0x3F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0xFF,
0xFF,0xFE,0xFC,0xF8,0xE0,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xCF,
0x63,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
0x60,0x60,0x60,0x60,0xC0,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0xC0,0x60,0x60,
0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
0x61,0x63,0xCF,0xFF,0xFF,0xFF,0xE0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xF0,0x0F,0xFF,0x1F,0x30,
0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
0x40,0x40,0x40,0x40,0x20,0x11,0x0F,0x02,
0x01,0x01,0x02,0x0F,0x11,0x20,0x40,0x40,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
0x40,0x20,0x30,0x1F,0xFF,0x0F,0xF7,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0F,0x10,0x3F,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
0x00,0x00,0x10,0x00,0x00,0x20,0x50,0x50,
0x50,0x50,0x90,0x08,0x08,0x08,0x08,0x08,
0x08,0x10,0x10,0x10,0x1F,0x10,0x2F,0x20,
0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0C,
0x30,0x40,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,
0x01,0x01,0x0E,0x00,0x00,0x02,0x05,0x05,
0x05,0x05,0x08,0x10,0x20,0x20,0x20,0xA0,
0x50,0x30,0x20,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x06,0xF8,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,0x80,0x41,0xC2,0x44,0xC4,0x48,
0x48,0xC8,0x48,0x50,0x50,0x30,0x10,0x00,
0x00,0x00,0x00,0x10,0x10,0x30,0xD0,0x48,
0xC8,0x48,0xC8,0x64,0xA4,0x62,0xA1,0x10,
0x08,0x04,0x03,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xC0,0x30,0x0F,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0xF0,0xB0,0x58,0xA8,0x44,0xAA,0x45,
0xAB,0x44,0xAA,0x44,0xAA,0x44,0xAA,0x44,
0xAA,0x45,0xAA,0x44,0xA8,0x48,0xA8,0x48,
0xA8,0x48,0xA8,0x44,0xAA,0x45,0xAA,0x44,
0xAA,0x44,0xAA,0x44,0xAA,0x44,0xAA,0x45,
0xAA,0x44,0xA8,0x70,0xC0,0xC0,0x20,0x10,
0x08,0x06,0x01,0x00,0x00,0x00,0x00,0x00};
char co
0x00,0x00,0x00,0x80,0xC0,0x40,0xA0,0x60,
0xA0,0x60,0xA0,0x40,0x80,0x40,0xA0,0x50,
0xA8,0x54,0x2C,0x16,0x2A,0x15,0x0B,0x15,
0x0B,0x15,0x2A,0x15,0x2A,0x55,0x2A,0x15,
0x2A,0x15,0x2A,0x15,0x0B,0x15,0x0B,0x16,
0x2A,0x54,0xA8,0x58,0xB0,0x60,0xB0,0x58,
0xA8,0x58,0xA8,0x58,0xA8,0x50,0xA0,0xC0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xF8,0xAE,0x55,0xAA,0x55,0xAA,0x55,
0xAA,0xD5,0xFA,0x57,0x2A,0x05,0x00,0x00,
0x20,0x20,0x10,0x10,0x10,0x20,0x20,0x40,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x20,0x10,0x10,0x08,0x08,0x08,
0x10,0x10,0x00,0x01,0x0A,0x15,0xAB,0x7D,
0xEA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,
0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0x0A,0x15,0x2A,0x35,0x2A,0x35,
0xAA,0x7F,0xEA,0x15,0x00,0x00,0xC0,0x30,
0x08,0xC4,0xE4,0xF4,0xF4,0xE8,0xD8,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xD8,0xE8,0xF4,0xF4,0xE4,
0xC4,0x08,0x30,0xC0,0x00,0x00,0x00,0xFD,
0x7F,0xF5,0x6A,0x55,0x2A,0x35,0x1A,0x0D,
0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x3F,0x40,0xFF,0x00,0x00,0x00,0x07,0x00,
0x00,0x0F,0x3F,0x7F,0x7F,0x3F,0x1F,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1F,0x3F,0x7F,0x7F,0x3F,
0x0F,0x00,0x00,0x03,0x00,0x00,0x00,0xFF,
0x40,0x3F,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,0x03,0x0C,0x30,0x40,0x80,
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,0x80,0xC0,0x70,0x1E,0x01,
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,
0x03,0x02,0x04,0x08,0x08,0x10,0x10,0x20,
0x20,0x21,0x41,0xC2,0x42,0x44,0x42,0xC2,
0x41,0x21,0x20,0x20,0x10,0x18,0x08,0x04,
0x04,0x02,0x03,0x01,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,0x00,0x00,0x00,0x00,
0x00,0x80,0x70,0x08,0x04,0x02,0x02,0x01,
0x01,0x01,0x01,0x07,0x08,0x10,0x08,0x07,
0x01,0x01,0x01,0x01,0x02,0x02,0x04,0x08,
0x70,0x80,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,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x1F,0xE6,0x02,0x02,0x02,0x04,0x38,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xC0,0x38,0x04,0x02,0x02,0x02,
0xE4,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
char co
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x80,0x00,0xC0,0x00,0x00,0x00,0x66,0x70,0x40,0x80,0xF0,0xF8,0xFC,0xFE,0xFE,
0xFF,0xFF,0xFF,0x7F,0x7F,0x7F,0x7E,0x7E,0x7C,0x70,0xE0,0xE0,0xEF,0xE7,0xC3,0xC2,
0xB3,0x07,0x01,0x01,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,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,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,
0x80,0x80,0xC3,0xE3,0x72,0x3B,0x1C,0x0E,0x07,0x07,0x0B,0x01,0x03,0x03,0x03,0x8B,
0xC9,0xC8,0xC0,0xE0,0xE0,0xE0,0xC0,0xC0,0x00,0x06,0x00,0x0C,0xB0,0xD0,0xD0,0xD1,
0x83,0x1F,0xFF,0xFF,0xFF,0xFE,0xFE,0x7C,0x00,0x00,0x30,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,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,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x8C,0xE7,0xF0,0xFC,0xFE,0xFE,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFD,0xF0,0xF0,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0x0F,0x1F,0x9F,
0xDF,0x9F,0x1F,0x1F,0xCF,0xC7,0xC3,0xC1,0x80,0xE0,0xE8,0xC6,0x1F,0x7F,0xFF,0x7F,
0xBF,0xFF,0xFE,0xFF,0xCF,0xC3,0x81,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00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0x00,0x00,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 LCDDisplay(unsigned char page,unsigned char lineaddress, unsigned char table[8][128])
{
for(i=0;i<8;i++)
{
if(lineaddress<0X80)
{
CS1=0;
CS2=0;
}
writecode(page+i);
writecode(lineaddress);
for(j=0;j<64;j++)
{
writedata(table[i][j]);
lineaddress+=1;
}
if(lineaddress>=0X80)
{
CS1=0;
CS2=1;
lineaddress=lineaddress-0X40;
}
writecode(page+i);
writecode(lineaddress);
for(j=64;j<128;j++)
{
writedata(table[i][j]);
lineaddress+=1;
}
if(lineaddress>=0X80)
{
lineaddress=lineaddress-0X40;
}
}
}
//半屏显示函数
void LCDDisplay12(unsigned char page,unsigned char lineaddress,unsigned char table[8][64])
{
if(lineaddress<0X80)
{
CS1=1;
CS2=0;
}
if(lineaddress>=0X80)
{
CS1=0;
CS2=1;
lineaddress=lineaddress-0X40;
}
for(i=0;i<8;i++)
{ writecode(page+i);
writecode(lineaddress);
for(j=0;j<64;j++)
{
writedata(table[i][j]);
}
}
}
void lcdinti()
{ writecode(0X3F);
writecode(0XC0);
writecode(0XB8);
writecode(0X40);
}
main()
{ lcdinti();
//LCDDisplay12(0Xb8,0X40,&zi1);
LCDDisplay(0Xb8,0X40,&ch);
while(1);
}
半屏显示,protues仿真如图:
全屏显示,protues仿真如图
上一篇:KEILC51编译问题ERROR L104
下一篇:AT89S52单片机模拟I2C总线协议读写AT24C04
推荐阅读最新更新时间:2024-03-16 15:10