cũng được kha khá hiểu biết ai cần thi xem và tự làm nhé
#include <REGX51.H>
sbit DATA = P1^0;
sbit SCK = P1^1;
sbit LACH = P1^2;
sbit DATA1=P2^0;
sbit SCK1=P2^1;
sbit LACH1=P2^2;
unsigned char a;
unsigned char p;
unsigned char i, j,k,l;
unsigned char mang[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
unsigned char mang1[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
unsigned char code ma[]={ 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,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0xFF,
0xFF,0xC7,0xBB,0xDD,0xDD,0xBB,0xC7,0xFF ,
0xFF,0x01,0x00,0xFC,0xFC,0x00,0x01,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,
};
unsigned char code ma1[]={ 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,
0x81,0x81,0xE7,0xE7,0xE7,0xE7,0x81,0x81,
0xFF,0xEF,0xD7,0xBB,0xBB,0xAB,0xD7,0xFF ,
0xC3,0x81,0x99,0x99,0x99,0x99,0x99,0x99 ,
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,
};
void tre(long time)
{ while(time--)
{;}}
void quet(unsigned char x)
{
unsigned int i,t;
for(i=0;i<8;i++)
{
t=x;
t=t&0x80;
if(t==0x80)
DATA=1;
else
DATA=0;
x*=2;
SCK=1;
SCK=0;
}
LACH=1;
LACH=0;
}
void quet1(unsigned char b)
{
unsigned int i,t;
for(i=0;i<8;i++)
{
t=b;
t=t&0x80;
if(t==0x80)
DATA1=1;
else
DATA1=0;
b<<=1;
SCK1=1;
SCK1=0;
}
LACH1=1;
LACH1=0;
}
void hienthi(void)
{
for(a=0;a<56;a++)
{
l=0;for(j=0;j<4;j++)
{
for(k=0;k<8;k++)
{ quet1(0xff);
quet1(0xff);
quet1(0xff);
quet1(0xff);
quet(0xff);
tre(1);
quet(ma[a+k]);
quet(ma[a+k+8]);
quet(ma[a+k+16]);
quet(ma[a+k+24]);
LACH=0;
LACH=1;
{quet1(mang1[k]);
quet1(mang1[k]);
quet1(mang1[k]);
quet1(mang1[k]);}
LACH1=1;
LACH1=0;
tre(50); tre(40);
l++;
}} } }
void hienthi1(void)
{ for(j=0;j<57;j++)
{
for(a=0;a<4;a++)
{
for(k=0;k<8;k++)
{l=0; quet1(0xff);
quet1(0xff);
quet1(0xff);
quet1(0xff);
quet(0xff);
quet(ma[56-j+k]);
quet(ma[64-j+k]);
quet(ma[72-j+k]);
quet(ma[80-j+k]);
LACH=0;
LACH1=0;
{quet1(mang1[k]);
quet1(mang1[k]);
quet1(mang1[k]);
quet1(mang1[k]);;}
LACH1=1;
LACH1=0;
tre(100);
//l++;
}} } }
void hienthi3(void)
{ for(j=0;j<56;j++)
{
for(a=0;a<2;a++)
{
for(k=0;k<8;k++)
{l=0; quet1(0xff); //chong lem
quet1(0xff);
quet1(0xff);
quet1(0xff);
quet(0xff);
quet(ma[k+28]);
quet(ma[k+36]);
quet(ma[k+44]);
quet(ma[k+52]);
LACH=0;
LACH1=0;
{quet1(mang1[k]);
quet1(mang1[k]);
quet1(mang1[k]);
quet1(mang1[k]);
}
LACH1=1;
LACH1=0;
tre(150);
//l++;
}} } }
void main(void)
{
while(1)
{ quet1(0xff);
quet(0xff);
LACH=0;
LACH=1;
hienthi();
LACH=0;
LACH=1;
hienthi1();
LACH=0;
LACH=1;
hienthi3();
tre(1);
LACH=0;
LACH=1;
hienthi();
LACH=0;
LACH=1;
}}
#include <REGX51.H>
sbit DATA = P1^0;
sbit SCK = P1^1;
sbit LACH = P1^2;
sbit DATA1=P2^0;
sbit SCK1=P2^1;
sbit LACH1=P2^2;
unsigned char a;
unsigned char p;
unsigned char i, j,k,l;
unsigned char mang[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
unsigned char mang1[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
unsigned char code ma[]={ 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,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0xFF,
0xFF,0xC7,0xBB,0xDD,0xDD,0xBB,0xC7,0xFF ,
0xFF,0x01,0x00,0xFC,0xFC,0x00,0x01,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,
};
unsigned char code ma1[]={ 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,
0x81,0x81,0xE7,0xE7,0xE7,0xE7,0x81,0x81,
0xFF,0xEF,0xD7,0xBB,0xBB,0xAB,0xD7,0xFF ,
0xC3,0x81,0x99,0x99,0x99,0x99,0x99,0x99 ,
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,
};
void tre(long time)
{ while(time--)
{;}}
void quet(unsigned char x)
{
unsigned int i,t;
for(i=0;i<8;i++)
{
t=x;
t=t&0x80;
if(t==0x80)
DATA=1;
else
DATA=0;
x*=2;
SCK=1;
SCK=0;
}
LACH=1;
LACH=0;
}
void quet1(unsigned char b)
{
unsigned int i,t;
for(i=0;i<8;i++)
{
t=b;
t=t&0x80;
if(t==0x80)
DATA1=1;
else
DATA1=0;
b<<=1;
SCK1=1;
SCK1=0;
}
LACH1=1;
LACH1=0;
}
void hienthi(void)
{
for(a=0;a<56;a++)
{
l=0;for(j=0;j<4;j++)
{
for(k=0;k<8;k++)
{ quet1(0xff);
quet1(0xff);
quet1(0xff);
quet1(0xff);
quet(0xff);
tre(1);
quet(ma[a+k]);
quet(ma[a+k+8]);
quet(ma[a+k+16]);
quet(ma[a+k+24]);
LACH=0;
LACH=1;
{quet1(mang1[k]);
quet1(mang1[k]);
quet1(mang1[k]);
quet1(mang1[k]);}
LACH1=1;
LACH1=0;
tre(50); tre(40);
l++;
}} } }
void hienthi1(void)
{ for(j=0;j<57;j++)
{
for(a=0;a<4;a++)
{
for(k=0;k<8;k++)
{l=0; quet1(0xff);
quet1(0xff);
quet1(0xff);
quet1(0xff);
quet(0xff);
quet(ma[56-j+k]);
quet(ma[64-j+k]);
quet(ma[72-j+k]);
quet(ma[80-j+k]);
LACH=0;
LACH1=0;
{quet1(mang1[k]);
quet1(mang1[k]);
quet1(mang1[k]);
quet1(mang1[k]);;}
LACH1=1;
LACH1=0;
tre(100);
//l++;
}} } }
void hienthi3(void)
{ for(j=0;j<56;j++)
{
for(a=0;a<2;a++)
{
for(k=0;k<8;k++)
{l=0; quet1(0xff); //chong lem
quet1(0xff);
quet1(0xff);
quet1(0xff);
quet(0xff);
quet(ma[k+28]);
quet(ma[k+36]);
quet(ma[k+44]);
quet(ma[k+52]);
LACH=0;
LACH1=0;
{quet1(mang1[k]);
quet1(mang1[k]);
quet1(mang1[k]);
quet1(mang1[k]);
}
LACH1=1;
LACH1=0;
tre(150);
//l++;
}} } }
void main(void)
{
while(1)
{ quet1(0xff);
quet(0xff);
LACH=0;
LACH=1;
hienthi();
LACH=0;
LACH=1;
hienthi1();
LACH=0;
LACH=1;
hienthi3();
tre(1);
LACH=0;
LACH=1;
hienthi();
LACH=0;
LACH=1;
}}