#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
sbit rst=P1^0;
sbit cs2=P1^1;
sbit cs1=P1^2;
sbit e=P1^3;
sbit rw=P1^4;
sbit rs=P1^5;
uchar code a[4][32]={/*-- 文字: 謝 --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
0x40,0x42,0xCC,0x00,0x00,0xFC,0x56,0x55,0xFC,0x80,0x10,0x10,0xFF,0x10,0x10,0x00,
0x00,0x00,0x3F,0x10,0x2A,0x13,0x4A,0x86,0x7F,0x00,0x43,0x80,0x7F,0x00,0x00,0x00,
/*-- 文字: 謝 --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
0x40,0x42,0xCC,0x00,0x00,0xFC,0x56,0x55,0xFC,0x80,0x10,0x10,0xFF,0x10,0x10,0x00,
0x00,0x00,0x3F,0x10,0x2A,0x13,0x4A,0x86,0x7F,0x00,0x43,0x80,0x7F,0x00,0x00,0x00,
/*-- 文字: , --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x58,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: 親 --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
0x40,0x40,0x44,0x44,0x54,0x64,0x45,0xC6,0x44,0x64,0x54,0x44,0x44,0x40,0x40,0x00,
0x00,0x42,0x22,0x12,0x0A,0x42,0x82,0x7F,0x02,0x02,0x0A,0x12,0x22,0x42,0x00,0x00
};
void delayms(uint q)
{
uint q1;
while(q--)
for(q1=0;q1<100;q1--);
}
void delayus(uint q2)
{
while(q2--);
}
void zhiling();
void shuju();
void chushi();
void qingping();
void DSA();
void xianshi();
void main()
{
chushi();
xianshi();
qingping();
while(1);
}
void zhiling(uint zx)
{
rs=0;
rw=0;
P0=zx;
e=1;
delayms(1);
e=0;
}
void shuju(uint xz)
{
rs=1;
rw=0;
P0=xz;
e=1;
delayms(1);
e=0;
}
void chushi()
{
rst=0;
delayms(1);
rst=1;
cs2=1;
cs1=1;
zhiling(0x3e);
zhiling(0x3f);
}
void qingping()
{
uchar n,m;
cs1=1;
cs2=1;
zhiling(0x3e);
zhiling(0x3f);
for(n=0;n<8;n++)
{
zhiling(0xb8+n);
zhiling(0xc0);
zhiling(0x40);
for(m=0;m<64;m++)
{
shuju(0x00);
}
}
}
void DSA(uchar ye,uchar lie,uchar ge,uchar ping)
{
uchar n1,m1;
if(ping==0)
{
cs1=1;
cs2=0;
}
if(ping==1)
{
cs1=0;
cs2=1;
}
for(n1=0;n1<2;n1++)
{
zhiling(0xb8+n1+ye);
zhiling(0x40+lie);
for(m1=1;m1<16;m1++)
{
shuju(a[ge][m1+n1+16]);
}
}
}
void xianshi()
{
DSA(0,32,0,0);
DSA(0,48,1,0);
DSA(0,0,2,1);
DSA(0,16,3,1);
}
怎樣才能 避免 亂碼呢。 |