LCD显示怎么用
#include <reg52.h>#define uchar unsigned char
sbit CS1=P2^0;
sbit CS2=P2^1;
sbit E=P2^2;
sbit RW=P2^3;
sbit DI=P2^4;
sbit RET=P2^5;
uchar code hanzi[2][32]={{0x80,0x90,0x8c,0x84,0x84,0xF4,0xA5,0x86,0x84,0x84,0x84,0x84,0x94,0x8C,0x84,0x00,
0x80,0x80,0x80,0x40,0x47,0x28,0x28,0x10,0x28,0x24,0x43,0xC0,0x40,0x00,0x00,0x00},
{0x90,0x48,0xE7,0x1A,0xB0,0xEE,0xA8,0xAF,0xA8,0x4E,0xF8,0x17,0x12,0xF0,0x10,0x00,
0x00,0x00,0xFF,0x20,0x54,0x86,0x7D,0x04,0x14,0xA4,0x40,0x27,0x1C,0xE3,0x40,0x00
}};
void delay1()
{
uchar x,y,z;
for(z=0;z<4;z++)
for(x=0;x<200;x++)
for(y=0;y<200;y++);
}
void wc(uchar a)
{
E=0;
DI=0;
RW=0;
P0=a;
E=1;
E=0;
}
void wd(uchar a)
{
E=0;
DI=1;
RW=0;
P0=a;
E=1;
E=0;
}
void tuxing1(uchar cs,uchar ye,uchar lie,uchar shu)
{
uchar i,t,d,f,y;
if(cs==0)
{
CS2=0;
CS1=1;
}
else
{
CS1=0;
CS2=1;
}
wc(0x3f);
wc(0xc0);
f=0xb8+ye;
y=0x42+lie; 是什么意思
for(i=0;i<2;i++)
{
wc(f);
wc(y);
for(t=0;t<16;t++)
{
d=hanzi[shu][t+i*16];
wd(d);
}
f++;
}
}
void clear()
{
uchar i,j,d;
wc(0xc0);
d=0xb8;
for(i=0;i<8;i++)
{
wc(d);
wc(0x40);
for(j=0;j<64;j++)
{
wd(0x00);
}
d++;
}
}
void INI()
{
RET=0;
delay1();
RET=1;
CS2=0;
CS1=1;
wc(0x3f);
wc(0xc0);
clear();
CS1=0;
CS2=1;
wc(0x3f);
wc(0xc0);
clear();
}
main()
{
uchar key,keyget;
INI();
tuxing1(0,2,16,0);
tuxing1(1,2,16,1);
while(1);
}