欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標(biāo)題:
單片機(jī)LED流星雨源程序分享
[打印本頁(yè)]
作者:
51hei社區(qū)
時(shí)間:
2016-1-16 05:28
標(biāo)題:
單片機(jī)LED流星雨源程序分享
電路很簡(jiǎn)單,從程序中可以看出來(lái),我就不畫(huà)了.
#include<reg52.h>
#define uchar unsigned char
#define led P1
bit flag=0;
uchar code lshift[3]={0x07,0x03,0x01};
uchar code shift[7]={0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe};
//imitate PWM data
uchar code sta0[100]={ 0x0f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,
0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,
0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,
0xcf,0xcf,0xcf,0xef,0xef,0xef,0xef,0xef,0xef,0xef,
0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,
0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,
0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,
0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,
0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,
0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef
};
//functions statement
void delay(uchar ms);
uchar exchg(uchar dat);
//main function
void main()
{
uchar i,j,k,x,sdata;
while(1)
{
for(k=1;k<8;k++)
for(i=0;i<22;i++)
for(j=0;j<100;j++)
{
sdata=(sta0[j]>>k)|shift[k-1];
if(flag==1) led=exchg(sdata);
else led=sdata;
}
for(x=1;x<4;x++)
for(i=0;i<22;i++)
for(j=0;j<100;j++)
{
sdata=( sta0[j]<<(4-x) )|lshift[x-1];
if(flag==1) led=exchg(sdata);
else led=sdata;
}
}
}
void delay(uchar ms)
{
uchar n;
while(ms--)
{
for(n=125;n>0;n--);
}
}
uchar exchg(uchar dat) //對(duì)字節(jié)的高位和低位進(jìn)行互換!
{
uchar temp;
temp=
((dat&0x01)<<7)|
((dat&0x02)<<5)|
((dat&0x04)<<3)|
((dat&0x08)<<1)|
((dat&0x10)>>1)|
((dat&0x20)>>3)|
((dat&0x40)>>5)|
((dat&0x80)>>7);
return temp;
}
復(fù)制代碼
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1