最近学单片机,觉得点阵屏挺好玩。
视频稍后
[flash=640,480]XXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXp/sid/XMzg4NzUzNDI4/v.swf target="_blank" style="font-size:20px;">点击此处查看视频不知道除了CROL CROR这样的函数外还有什么函数可以达到一些规律动画。一列一列去点阵很累啊[s:221]
#include<reg52.h>
#include<INTRINS.H>
unsigned char yc;
unsigned int li=0x80;
unsigned int han=0x7f;
unsigned int li2=0x80;
unsigned int han2=0xfe;
char js;
unsigned char code lie[]={
0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x1
};
unsigned char code sb1[]=
{
0xc7,0xb7,0x77,0xb3,0xc5,0xe6,0xd5,0x33
};
void ys(unsigned char ys)
{
char ys2;
for(ys;ys>0;ys--)
for(ys2=100;ys2>0;ys2--);
}
void ds2()
{
P1=li2;
P0=han2;
ys(101);
P0=0xff;
li2=_cror_(li2,1);
han2=_cror_(han2,1);
ys(1);
}
void ds()
{
P1=li2;
P0=han2;
ys(101);
P0=0xff;
li2=_cror_(li2,1);
han2=_crol_(han2,1);
ys(1);
}
void shan()
{
P1=li;
ys(1);
P0=han;
ys(101);
P0=0xff;
li=_crol_(li,1);
han=_crol_(han,1);
}
void shan2()
{
P1=li;
ys(1);
P0=han;
ys(101);
P0=0xff;
li=_cror_(li,1);
han=_cror_(han,1);
}
void sb(unsigned char yu)
{
for(js=0;js<8;js++)
{
P1=lie[js];
P0=sb1[js];
P0=0xff;
}
for(yu;yu>0;yu--);
}
void main()
{
while(1)
{
unsigned char yc,xh;
for(xh=20;xh>0;xh--)
{
for(yc=150;yc>0;yc--)
sb(yc);
for(yc=0;yc<150;yc++)
sb(yc);
}
for(yc=100;yc>0;yc--)
{
ds();
shan();
}
for(yc=10;yc>0;yc--)
{
shan();
shan2();
}
for(yc=50;yc>0;yc--)
ds();
for(yc=50;yc>0;yc--)
ds2();
li=0x80;
han=0x7f;
li2=0x80;
han2=0xfe;
}
}
#include<reg52.h>
unsigned char code hybs[]={0x89,0x91,0x83};
unsigned char code wei[]={0x80,0x40,0x20};
unsigned char code lie[]={0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x1};
unsigned char code hybd[]={0x3c,0x3c,0x3c,0x0,0x0,0x3c,0x3c,0x3c};
unsigned char code hybd2[]={0x7e,0xbd,0xdb,0xe7,0xe7,0xe7,0xe7,0xe7};
unsigned char code hybd3[]={0xff,0x9f,0xaf,0x9f,0x9f,0xaf,0x9f,0xff};
void ys(int c)
{
char d,e;
for(c;c>0;c--)
for(d=100;d>0;d--)
for(e=10;e>0;e--);
}
void main()
{
unsigned char a,b,f,g;
for(b=255;b>0;b--)
for(a=0;a<3;a++)
{
P1=wei[a];
P0=hybs[a];
ys(1);
P0=0xff;
ys(1);
}
for(g=100;g>0;g--)
{
for(f=0;f<8;f++)
{
P1=lie[f];
P0=hybd[f];
ys(1);
P0=0xff;
}
}
for(g=100;g>0;g--)
{
for(f=0;f<8;f++)
{
P1=lie[f];
P0=hybd2[f];
ys(1);
P0=0xff;
}
}
for(g=100;g>0;g--)
{
for(f=0;f<8;f++)
{
P1=lie[f];
P0=hybd3[f];
ys(1);
P0=0xff;
}
}
}
如果你觉得这贴好,请点击推荐让更多人知道。谢谢