#include<stc89.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
uint ee;
uchar f;
sbit lcd_cs3=P1^0;//片选信号右 低有效
sbit lcd_cs2=P1^1;//片选信号中 低有效
sbit lcd_cs1=P1^2;//片选信号左 低有效
sbit lcd_e =P1^3;//使能信号
sbit lcd_rw =P1^4;//读写选择
sbit lcd_rs =P1^5;//数据命令选择端 H数据 L命令
sbit lcd_rst=P1^6;// 液晶复位引脚 低有效 低的话 就一直复位了
//P2八位数据线
uchar code cc[]={
/*---------------小----------------*/
0xFF,0xFF,0xFF,0xFF,0xBF,0xDF,0xEF,0xE7,0xF3,0xF9,0xFB,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFE,0xFE,0xFE,0xFE,0xF6,0xF2,0xE6,0xEE,0xDE,0xBE,0x7E,0xFE,0xFE,0xFE,0xFA,0xFD,
/*---------------鹏----------------*/
0xEF,0xDF,0x83,0x9B,0xAB,0xAB,0xB3,0xBF,0x81,0xFD,0xFD,0x05,0xFD,0xEB,0xF7,0xFF,
0xFF,0x88,0xAA,0xAA,0x88,0xAA,0xAA,0xAA,0x88,0xAA,0xAA,0xAA,0xAA,0x46,0xEC,0xFF,
/*---------------工----------------*/
0xFF,0xFF,0xFF,0xF7,0xF7,0xF7,0xF7,0x07,0xFB,0xFB,0xFB,0xFB,0xFF,0xFF,0xFF,0xFF,
0xFF,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xF0,0xF7,0xF7,0xF7,0xF7,0xF7,0xF7,0xFF,0xFF,
/*---------------作----------------*/
0x7F,0xBF,0xDF,0x07,0xF8,0xBF,0xCF,0xE3,0x0C,0x6F,0x6F,0xB7,0xB7,0xF7,0xFF,0xFF,
0xFF,0xFF,0xFF,0x80,0xFF,0xFF,0xFF,0xFF,0x80,0xFB,0xFB,0xFD,0xFD,0xFD,0xFF,0xFF,
/*---------------室----------------*/
0xFF,0xFF,0xE7,0xD7,0x57,0x97,0xD6,0xD9,0x6B,0x6B,0x2B,0x73,0xFB,0xFF,0xFF,0xFF,
0xFF,0xBF,0xBF,0xB6,0xB6,0xB6,0xB6,0xC0,0xDB,0xDB,0xDB,0xDE,0xDF,0xFF,0xFF,0xFF,
/*---------------开----------------*/
0xFF,0x7F,0x7F,0x7B,0x7B,0x03,0xBD,0xBD,0xBD,0x01,0xBD,0xBD,0xBF,0xBF,0xFF,0xFF,
0xFF,0xBF,0xDF,0xEF,0xF3,0xFC,0xFF,0xFF,0xFF,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
/*---------------发----------------*/
0xFF,0xFF,0xDF,0xC1,0xDF,0x1F,0x60,0x6F,0x6F,0xAD,0x2B,0xEF,0xEF,0xFF,0xFF,0xFF,
0xDF,0xEF,0xB7,0xBB,0xDC,0xDD,0xEB,0xF7,0xF3,0xED,0xDE,0xBF,0xBF,0xBF,0xFF,0xFF,
/*-------------------------------*/
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
};
uchar code dd[]={
/*---------------小----------------*/
0x00,0x00,0x00,0x00,0x40,0x20,0x10,0x18,0x0C,0x06,0x04,0x00,0x00,0x00,0x00,0x00,
0x01,0x01,0x01,0x01,0x09,0x0D,0x19,0x11,0x21,0x41,0x81,0x01,0x01,0x01,0x05,0x02,
/*---------------鹏----------------*/
0x10,0x20,0x7C,0x64,0x54,0x54,0x4C,0x40,0x7E,0x02,0x02,0xFA,0x02,0x14,0x08,0x00,
0x00,0x77,0x55,0x55,0x77,0x55,0x55,0x55,0x77,0x55,0x55,0x55,0x55,0xB9,0x13,0x00,
/*---------------工----------------*/
0x00,0x00,0x00,0x08,0x08,0x08,0x08,0xF8,0x04,0x04,0x04,0x04,0x00,0x00,0x00,0x00,
0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,
/*---------------作----------------*/
0x80,0x40,0x20,0xF8,0x07,0x40,0x30,0x1C,0xF3,0x90,0x90,0x48,0x48,0x08,0x00,0x00,
0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x7F,0x04,0x04,0x02,0x02,0x02,0x00,0x00,
/*---------------室----------------*/
0x00,0x00,0x18,0x28,0xA8,0x68,0x29,0x26,0x94,0x94,0xD4,0x8C,0x04,0x00,0x00,0x00,
0x00,0x40,0x40,0x49,0x49,0x49,0x49,0x3F,0x24,0x24,0x24,0x21,0x20,0x00,0x00,0x00,
/*---------------开----------------*/
0x00,0x80,0x80,0x84,0x84,0xFC,0x42,0x42,0x42,0xFE,0x42,0x42,0x40,0x40,0x00,0x00,
0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,
/*---------------发----------------*/
0x00,0x00,0x20,0x3E,0x20,0xE0,0x9F,0x90,0x90,0x52,0xD4,0x10,0x10,0x00,0x00,0x00,
0x20,0x10,0x48,0x44,0x23,0x22,0x14,0x08,0x0C,0x12,0x21,0x40,0x40,0x40,0x00,0x00,
};
void lcd_init();
void wrile_com(uchar com);
void wrile_data(uchar dat);
void QPCZ(uchar TT,rg) ; //液晶屏 清屏操作
void XYZ(uchar q1,q2,q3);
void delay(uchar d0);
void main()
{
while(1)
{lcd_init();
QPCZ(0x11,0xff);
delay(250);delay(250);delay(250);delay(250);delay(250);delay(250);
delay(250);delay(250);delay(250);delay(250);delay(250);delay(250);
QPCZ(0x00,0x00);
XYZ(0xc0,0xb8,0x60);
lcd_cs1=0;
lcd_cs2=1;
lcd_cs3=1;
for(f=0;f<224;f++)
{
if(f==64)
{lcd_cs1=1;
lcd_cs2=0;
lcd_cs3=1;
}
if(f==192)
{lcd_cs1=1;
lcd_cs2=1;
lcd_cs3=0;
}
switch(f) // 括号里面的语句和 case比较
{case 16:XYZ(0xc0,0xb9,0x60); //比较一样
break;
case 32:XYZ(0xc0,0xb8,0x70); //比较一样
break;
case 48:XYZ(0xc0,0xb9,0x70); //比较一样
break;
case 64:XYZ(0xc0,0xb8,0x40); //比较一样
break;
case 80:XYZ(0xc0,0xb9,0x40); //比较一样
break;
case 96:XYZ(0xc0,0xb8,0x50); //比较一样
break;
case 112:XYZ(0xc0,0xb9,0x50); //比较一样
break;
case 128:XYZ(0xc0,0xb8,0x60); //比较一样
break;
case 144:XYZ(0xc0,0xb9,0x60); //比较一样
break;
case 160:XYZ(0xc0,0xb8,0x70); //比较一样
break;
case 176:XYZ(0xc0,0xb9,0x70); //比较一样
break;
case 192:XYZ(0xc0,0xb8,0x40); //比较一样
break;
case 208:XYZ(0xc0,0xb9,0x40); //比较一样
break;
}
// delay(250);delay(250);delay(250);delay(250);delay(250);delay(250);
wrile_data(cc[f]);
}
XYZ(0xc0,0xb8,0x60);
lcd_cs1=0;
lcd_cs2=1;
lcd_cs3=1;
XYZ(0xc0,0xb8,0x60);
lcd_cs1=0;
lcd_cs2=1;
lcd_cs3=1;
for(f=0;f<224;f++)
{
if(f==64)
{lcd_cs1=1;
lcd_cs2=0;
lcd_cs3=1;
}
if(f==192)
{lcd_cs1=1;
lcd_cs2=1;
lcd_cs3=0;
}
switch(f) // 括号里面的语句和 case比较
{case 16:XYZ(0xc0,0xb9,0x60); //比较一样
break;
case 32:XYZ(0xc0,0xb8,0x70); //比较一样
break;
case 48:XYZ(0xc0,0xb9,0x70); //比较一样
break;
case 64:XYZ(0xc0,0xb8,0x40); //比较一样
break;
case 80:XYZ(0xc0,0xb9,0x40); //比较一样
break;
case 96:XYZ(0xc0,0xb8,0x50); //比较一样
break;
case 112:XYZ(0xc0,0xb9,0x50); //比较一样
break;
case 128:XYZ(0xc0,0xb8,0x60); //比较一样
break;
case 144:XYZ(0xc0,0xb9,0x60); //比较一样
break;
case 160:XYZ(0xc0,0xb8,0x70); //比较一样
break;
case 176:XYZ(0xc0,0xb9,0x70); //比较一样
break;
case 192:XYZ(0xc0,0xb8,0x40); //比较一样
break;
case 208:XYZ(0xc0,0xb9,0x40); //比较一样
break;
}
//delay(250);delay(250);delay(250);delay(250);delay(250);delay(250);
wrile_data(dd[f]);
}
XYZ(0xc0,0xba,0x60);
lcd_cs1=0;
lcd_cs2=1;
lcd_cs3=1;
XYZ(0xc0,0xba,0x60);
lcd_cs1=0;
lcd_cs2=1;
lcd_cs3=1;
for(f=0;f<224;f++)
{
if(f==64)
{lcd_cs1=1;
lcd_cs2=0;
lcd_cs3=1;
}
if(f==192)
{lcd_cs1=1;
lcd_cs2=1;
lcd_cs3=0;
}
switch(f) // 括号里面的语句和 case比较
{case 16:XYZ(0xc0,0xbb,0x60); //比较一样
break;
case 32:XYZ(0xc0,0xba,0x70); //比较一样
break;
case 48:XYZ(0xc0,0xbb,0x70); //比较一样
break;
case 64:XYZ(0xc0,0xba,0x40); //比较一样
break;
case 80:XYZ(0xc0,0xbb,0x40); //比较一样
break;
case 96:XYZ(0xc0,0xba,0x50); //比较一样
break;
case 112:XYZ(0xc0,0xbb,0x50); //比较一样
break;
case 128:XYZ(0xc0,0xba,0x60); //比较一样
break;
case 144:XYZ(0xc0,0xbb,0x60); //比较一样
break;
case 160:XYZ(0xc0,0xba,0x70); //比较一样
break;
case 176:XYZ(0xc0,0xbb,0x70); //比较一样
break;
case 192:XYZ(0xc0,0xba,0x40); //比较一样
break;
case 208:XYZ(0xc0,0xbb,0x40); //比较一样
break;
}
// delay(250);delay(250);delay(250);delay(250);delay(250);
delay(250);
wrile_data(cc[f]);
}
QPCZ(0xff,0xff);
delay(250);delay(250);delay(250);
}
}
void lcd_init()
{
lcd_rst=0;
delay(50);
lcd_rst=1;
delay(255);//等待复位
lcd_cs1=0;
lcd_cs2=0;
lcd_cs3=0;
wrile_com(0x3f);
}
void wrile_com(uchar com)
{ lcd_e=0; //
lcd_rw=0;//读写选择 写
lcd_rs=0;//数据命令 命令
lcd_e=1; //
P2=com;
_nop_();
lcd_e=0;
delay(5);
}
void wrile_data(uchar dat)
{ lcd_e=0; //
lcd_rw=0;//读写选择 写
lcd_rs=1;//数据命令 命令
lcd_e=1; //
P2=dat;
_nop_();
lcd_e=0;
delay(5);
}
void XYZ(uchar q1,q2,q3)
{ wrile_com(q1);//显示起始行
wrile_com(q2);//页面地址
wrile_com(q3);//列地址设置
}
void QPCZ(uchar TT,rg) //液晶屏 清屏操作
{uchar qw,qe,er;
lcd_cs1=0;
lcd_cs2=0;
lcd_cs3=0;
er=0xb8;
XYZ(0xc0,0xb8,0x40);
for(qw=0;qw<8;qw++)
{
wrile_com(er);//页面地址
for(qe=0;qe<64;qe++)
{ wrile_data(TT);delay(rg); }
wrile_com(er++);//页面地址
}
}
void delay(uchar d0)
{uchar d1,d2;
for(d1=d0;d1>0;d1--)
for(d2=110;d2>0;d2--);
}
|