#include <reg51.h>
#include <intrins.h>
typedef unsigned int WORD;
const WORD code encoding_00[] = //神
{
0x0208, 0x0108, 0x0089, 0xffce, 0x00a8, 0x0318, 0x0000, 0x07f8,
0x0248, 0x0248, 0xffff, 0x0248, 0x0248, 0x07f8, 0x0000, 0x0000,
0x0000, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x3ffe,
0x4020, 0x4020, 0x4020, 0x4020, 0x4020, 0x3820, 0x0020, 0x0000,
0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
0x0002, 0x03fe, 0x0c60, 0x1090, 0x2108, 0x4000, 0x7800, 0x0000,
0x8080, 0x6080, 0x1ffc, 0x4296, 0x84a5, 0x7ffc, 0x0080, 0x0040,
0x7e3e, 0x2202, 0x2202, 0x2202, 0x227e, 0x7e40, 0x0040, 0x0000
};
const WORD code encoding_01[] = //Pic
{
0x0103, 0x0706, 0x8a00, 0x0000, 0x0000, 0x0007, 0xc000, 0x0000,
0x0000, 0x0003, 0xe000, 0x0000, 0x0000, 0x0001, 0x7000, 0x0000,
0x0000, 0x0000, 0xf000, 0x1800, 0x0000, 0x0000, 0xf000, 0x0e00,
0x0000, 0x0000, 0x0000, 0x1e00, 0x0000, 0x0000, 0x0000, 0x1700,
0x0000, 0x0000, 0x0000, 0x1780, 0x0000, 0x0300, 0x03e0, 0x1bc0,
0x0000, 0x0380, 0x03b0, 0xfdc0, 0x0000, 0x01c0, 0x061f, 0x97e0,
0x0000, 0x00f0, 0x0e03, 0x1bf0, 0x0000, 0x0070, 0x1fff, 0x89f0,
0x0000, 0x0010, 0x3000, 0xd8f8, 0x0000, 0x0001, 0xe000, 0x7068,
0x0000, 0x0003, 0x2001, 0xe028, 0x0000, 0x0002, 0xe3ff, 0xa038,
0x0000, 0x0003, 0xa203, 0xe000, 0x0000, 0x0001, 0xa280, 0x6000,
0x0000, 0x0000, 0xe2c0, 0x3000, 0x0000, 0x0000, 0x6260, 0x3800,
0x0000, 0x0000, 0x7aa0, 0x2c00, 0x0000, 0x0000, 0x7150, 0x3400,
0x0000, 0x0000, 0x71f8, 0x1e00, 0x0000, 0x0000, 0x303c, 0x2a00,
0x0000, 0x0000, 0x781e, 0x3b00, 0x0000, 0x0030, 0xc81f, 0x0d00,
0x0000, 0x0038, 0x8c07, 0x8580, 0x0000, 0x003c, 0x8603, 0x8680,
0xff00, 0x001e, 0x8301, 0xc380, 0x3d80, 0x001e, 0x8780, 0x0180,
0x67e0, 0x000b, 0xfc80, 0x01c0, 0x3ffe, 0x000d, 0x80c0, 0x01c0,
0x003f, 0x0007, 0xc060, 0x01e0, 0x010f, 0x0007, 0xc020, 0x01e0,
0x7c07, 0xf003, 0xe030, 0x01e0, 0x1033, 0xe801, 0xf81b, 0x00e0,
0x179f, 0xe000, 0x780f, 0x80e0, 0x1802, 0xf400, 0x7807, 0x80a0,
0x0713, 0x7c00, 0x1801, 0xffe0, 0x0300, 0x3e00, 0x0000, 0xfff0,
0x0060, 0x0f80, 0x0000, 0x3ff0, 0x0067, 0xa780, 0x0000, 0x1ff0,
0x0012, 0x23c0, 0x0000, 0x00f0, 0x0001, 0x31c0, 0x0000, 0x0000,
0x0000, 0x23c0, 0x0000, 0x0000, 0x0000, 0x0640, 0x0000, 0x0000,
0x0000, 0x8c60, 0x0000, 0x0000, 0x0000, 0x2520, 0x0000, 0x0000,
0x0000, 0x1230, 0x0000, 0x0000, 0x0000, 0x7120, 0x0000, 0x0000,
0x0000, 0x1170, 0x0000, 0x0000, 0x0000, 0x1030, 0x0000, 0x0000,
0x0000, 0x0230, 0x0000, 0x0000, 0x0000, 0x02b8, 0x0000, 0x0000,
0x0000, 0x0ab0, 0x0000, 0x0000, 0x0000, 0x00f8, 0x0000, 0x0000,
0x0000, 0x0c30, 0x0000, 0x0000, 0x0000, 0x04b0, 0x0000, 0x0000,
0x0000, 0x0130, 0x0000, 0x0000, 0x0000, 0x0020, 0x0000, 0x0000,
0x0000, 0x0020, 0x0000, 0x0000, 0x0000, 0x0020, 0x0000, 0x0000
};
#define uchar unsigned char
#define uint unsigned int
sbit p3_0=P3^0;
sbit p3_1=P3^1;
sbit p3_2=P3^2;
sbit p3_3=P3^3;
sbit p3_4=P3^4;
sbit p3_5=P3^5;
sbit p2_7=P2^7;
#define LCD_RW p3_1
#define LCD_DI p3_2
#define LCD_E p3_0
#define LCD_CS1 p3_4
#define LCD_CS2 p3_3
#define LCD_RES p3_5
#define LCD_BUSY p2_7
#define LCDPORT P2
#define LCDSTARTROW 0xC0
delay_ms(int ms)
{uchar i;
uint j;
for(j=2*ms;j>0;j--)
for(i=250;i>0;i--);
}
bit ChechBusy()
{
LCDPORT=0xFF;
LCD_RW=1;
LCD_DI=0;
LCD_E=1;
LCD_E=0;
return LCD_BUSY;
}
void write_cmd(uchar cmd)
{
while(ChechBusy());
LCD_E=0;
LCD_RW=0;
LCD_DI=0;
LCDPORT=cmd;
LCD_E=1;
LCD_E=0;
}
void write_data(uchar d)
{
while(ChechBusy());
LCD_E=0;
LCD_RW=0;
LCD_DI=1;
LCDPORT=d;
LCD_E=1;
LCD_E=0;
}
void LCD_init()
{
LCD_CS1=1;
LCD_CS2=1;
write_cmd(0x3F); //开显示。
write_cmd(LCDSTARTROW); //设置起始行。
}
void main()
{
int i,j;
uchar u, *p=encoding_01;
LCD_init();
LCD_CS1=1;
LCD_CS2=1;
P1=0;
for (i=0;i<64;i++)
{ write_cmd(0xb9);
write_data(encoding_00[i]);
}
write_cmd(0x40);
for (i=0;i<64;i++)
{ write_cmd(0xba);
write_data(encoding_00[i]>>8);
}
LCD_CS1=0;
LCD_CS2=1;
for (i=0;i<64*8;i++)
{
u=0xb8+(7-i%8);
write_cmd(u);
u=0x40+i/8;
write_cmd(u);
u=*((uchar *)encoding_01+i);
write_data(u);
}
for (u=0;u<64;u++)
{
write_cmd(0xc0+u);
delay_ms(500);
}
while(1);
}