#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 datauchar 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 statementvoid delay(uchar ms); uchar exchg(uchar dat);//main functionvoid 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) //对字节的高位和低位进行互换!{ 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;}
导读:目前正在解读《单片机LED流星雨源程序分享》的相关信息,《单片机LED流星雨源程序分享》是由用户自行发布的知识型内容!下面请观看由(电工技术网 - www.9ddd.net)用户发布《单片机LED流星雨源程序分享》的详细说明。
简介:本文和大家分享一个单片机LED流星雨源程序,感兴趣的朋友可以看看。
提醒:《单片机LED流星雨源程序分享》最后刷新时间 2024-03-14 00:58:17,本站为公益型个人网站,仅供个人学习和记录信息,不进行任何商业性质的盈利。如果内容、图片资源失效或内容涉及侵权,请反馈至,我们会及时处理。本站只保证内容的可读性,无法保证真实性,《单片机LED流星雨源程序分享》该内容的真实性请自行鉴别。