這是我的一個廣州燈塔的制作
0.png (75.38 KB, 下載次數: 247)
下載附件
2016-4-24 21:50 上傳
程序仿真資料(壓縮包)下載:
程序 仿真圖.rar
(92 KB, 下載次數: 248)
2016-4-24 21:51 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
制作教程:
跟風模仿廣州塔,最美LEDDIY.rar
(1.04 MB, 下載次數: 251)
2016-4-22 21:01 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
小蠻腰的仿真電路圖:
0.png (32.32 KB, 下載次數: 256)
下載附件
2016-4-24 21:52 上傳
單片機小蠻腰的制作過程:
0.png (344.1 KB, 下載次數: 226)
下載附件
2016-4-24 21:44 上傳
0.png (351.85 KB, 下載次數: 206)
下載附件
2016-4-24 21:45 上傳
0.png (325.47 KB, 下載次數: 208)
下載附件
2016-4-24 21:45 上傳
0.png (333.92 KB, 下載次數: 240)
下載附件
2016-4-24 21:46 上傳
0.png (74.15 KB, 下載次數: 179)
下載附件
2016-4-24 21:46 上傳
0.png (389.71 KB, 下載次數: 226)
下載附件
2016-4-24 21:46 上傳
0.png (492.04 KB, 下載次數: 229)
下載附件
2016-4-24 21:46 上傳
0.png (516.56 KB, 下載次數: 217)
下載附件
2016-4-24 21:47 上傳
0.png (346.84 KB, 下載次數: 213)
下載附件
2016-4-24 21:47 上傳
0.png (385.36 KB, 下載次數: 223)
下載附件
2016-4-24 21:47 上傳
單片機廣州小蠻腰燈塔的程序:
- #include <AT89X51.H>
- #include <intrins.h>
- #define uchar unsigned char
- #define uint unsigned int
- #define p0 P0
- #define p1 P1
- #define p2 P2
- #define p3 P3
- uchar taba[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
- 0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
- uchar tabc[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
- uchar tabb[]={0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff};
- uchar tabd[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00};
- uchar a,b,c,d,e,f,g,h,i,j,k,l;
- void delaya();
- void delayb();
- void delayc();
- void delayd();
- void delaye();
- void delayf();
- void delayg();
- void delayh();
- void delayi();
- void delayj();
- void delay(unsigned int z)
- {
- while(z--);
- }
- void main()
- {
- TMOD=0x11;
- TH0=(65536-2000)/256;
- TL0=(65536-2000)%256;
- TH1=(65536-10000)/256;
- TL1=(65536-10000)%256;
- ET0=1;
- TR0=1;
- ET1=1;
- TR1=1;
- EA=1;
- while(1)
- {
- delaya();
- delayb();
- delayc();
- delayd();
- delaye();
- delayf();
- delayg();
- delayh();
- delayi();
- delayj();
- }
- }
- void li1() interrupt 1
- {
- TH0=(65536-2000)/256;
- TL0=(65536-2000)%256;
- i++;
- if(i==5) i=0;j++;
- if(j==16) j=0;
- }
- void li2() interrupt 3
- {
- TH1=(65536-10000)/256;
- TL1=(65536-10000)%256;
- h++;
- if(h==50) h=0;e++;l++;
- if(e==8) e=0;
- if(l==16) l=0;
- }
- void delaya()
- {
- for(c=0;c<3;c++)//下移
- {
- p0=0xff;p1=0xff;
- for(a=0;a<16;a++)
- {
- p2=taba[a];
- delay(6000);
- }
- }
- for(c=0;c<3;c++)//上移
- {
- p0=0xff;p1=0xff;
- for(a=0;a<16;a++)
- {
- p2=taba[15-a];
- delay(6000);
- }
- }
- for(c=0;c<3;c++)//上移和下移一起
- {
- p0=0xff;p1=0xff;
- for(a=0;a<16;a++)
- {
- p2=taba[16-a];
- delay(4000);
- p2=taba[a];
- delay(4000);
- }
- }
- for(a=0;a<200;a++)
- {
- p0=0x01;
- p1=0x01;
- for(b=0;b<=8;b++)
- {
- p2=taba[15-j];
- p0=_crol_(p0,1);
- p1=_crol_(p0,1);
- delay(200);
- }
- }
- }
- void delayb()
- {
- for(a=0;a<8;a++)
- {
- for(g=0;g<16;g++)
- {
- p1=0x00;
- p2=taba[g];
- p0=tabc[a];
- delay(3000);
- }
- for(g=0;g<16;g++)
- {
- p2=taba[g];
- p0=0x00;
- p1=tabc[a];
- delay(3000);
- }
- }
- for(a=0;a<200;a++)
- {
- p0=0x3f;
- p1=0x3f;
- for(b=0;b<=8;b++)
- {
- p2=taba[j];
- p0=_crol_(p0,1);
- p1=_crol_(p0,1);
- delay(200);
- }
- }
- for(a=0;a<20;a++)//右移
- {
- for(c=0;c<=8;c++)
- {
- for(b=0;b<16;b++)
- {
- p2=taba[b];
- delay(125);
- }
- p0=tabc[8-c];
- p1=tabc[8-c];
- delay(1000);
- }
- }
- }
- void delayc()
- {
- for(a=0;a<2;a++)
- {
- for(g=0;g<=16;g++)
- {
- if(g<8)
- {
- p1=0x00;
- p2=taba[g];
- p0=tabb[g];
- delay(4000);
- p2=taba[g];
- p0=0x00;
- p1=tabb[g];
- delay(4000);
- }
- if(g>=8)
- {
- p1=0x00;
- p2=taba[g];
- p0=tabb[g-8];
- delay(4000);
- p2=taba[g];
- p0=0x00;
- p1=tabb[g-8];
- delay(4000);
- }
- }
- }
- for(a=0;a<200;a++)
- {
- p0=0x01;
- p1=0x01;
- for(b=0;b<=8;b++)
- {
- p2=taba[j];
- p0=_cror_(p0,1);
- p1=_cror_(p0,1);
- delay(200);
- }
- }
- for(f=0;f<2;f++)
- {
- for(g=0;g<=16;g++)
- {
- if(g<8)
- {
- p2=taba[g];
- p1=0x00;
- p0=tabb[g];
- delay(8000);
- }
- if(g>=8)
- {
- p2=taba[g];
- p1=tabb[g-8];
- delay(8000);
- }
- }
- }
- for(b=0;b<80;b++)
- {
- for(a=0;a<15;a++)
- {
- p0=tabc[l];
- p1=tabc[l];
- p2=taba[j];
- delay(600);
- }
- }
- }
- void delayd()
- {
- for(a=0;a<=8;a++)
- {
- for(g=0;g<=16;g++)
- {
- p1=0x00;
- p2=taba[g];
- p0=tabb[a];
- delay(2500);
- p2=taba[g];
- p0=0x00;
- p1=tabb[a];
- delay(2500);
- }
- }
- for(a=0;a<=8;a++)
- {
- for(g=0;g<=16;g++)
- {
- p1=0x00;
- p2=taba[16-g];
- p0=tabb[a];
- delay(2500);
- p2=taba[16-g];
- p0=0x00;
- p1=tabb[a];
- delay(2500);
- }
- }
- for(b=0;b<120;b++)
- {
- for(a=0;a<15;a++)
- {
- p0=tabc[l];
- p1=tabc[l];
- p2=taba[j];
- delay(200);
- }
- }
- }
- void delaye()
- {
- for(a=0;a<20;a++)//左移
- {
- for(c=0;c<8;c++)
- {
- for(b=0;b<16;b++)
- {
- p2=taba[b];
- delay(125);
- }
- p0=tabc[c];
- p1=tabc[c];
- delay(1000);
- }
- }
- for(c=0;c<3;c++)//上移和下移一起
- { p0=0xff;p1=0xff;
- for(a=0;a<16;a++)
- {
- p2=taba[16-a];
- delay(4000);
- p2=taba[a];
- delay(4000);
- }
- }
- }
- void delayf()
- {
- for(a=0;a<=8;a++)
- {
- for(g=0;g<=16;g++)
- {
- p1=0x00;
- p2=taba[16-g];
- p0=tabb[8-a];
- delay(2500);
- p2=taba[16-g];
- p0=0x00;
- p1=tabb[8-a];
- delay(2500);
- }
- }
- for(b=0;b<80;b++)
- {
- for(a=0;a<15;a++)
- {
- p0=tabc[l];
- p1=tabc[l];
- p2=taba[j];
- delay(450);
- }
- }
- }
- void delayg()
- {
- for(b=0;b<120;b++)
- {
- for(a=0;a<15;a++)
- {
- p0=tabc[8-e];
- p1=tabc[8-e];
- p2=taba[15-j];
- delay(150);
- }
- }
- for(d=0;d<120;d++)
- {
- p0=0x01;
- p1=0x01;
- for(b=0;b<=8;b++)
- {
- p2=taba[15-j];
- p0=_crol_(p0,1);
- p1=_crol_(p0,1);
- delay(200);
- }
- p0=0x01;
- p1=0x01;
- for(b=0;b<=8;b++)
- {
- p2=taba[j];
- p0=_crol_(p0,1);
- p1=_crol_(p0,1);
- delay(200);
- }
- }
- for(c=0;c<3;c++)//由中間向兩邊移動
- {
- p0=0xff;
- p1=0xff;
- for(a=8;a<16;a++)
- {
- p2=taba[a];
- delay(4000);
- p2=taba[16-a];
- delay(4000);
- }
- }
- for(a=0;a<200;a++)
- {
- p0=0x3f;
- p1=0x3f;
- for(b=0;b<=8;b++)
- {
- p2=taba[15-j];
- p0=_cror_(p0,1);
- p1=_cror_(p0,1);
- delay(200);
- }
- }
- for(b=0;b<80;b++)
- {
- for(a=0;a<15;a++)
- {
- p0=tabc[e];
- p1=tabc[e];
- p2=taba[j];
- delay(600);
- }
- }
- }
- void delayh()
- {
- for(a=0;a<2;a++)//左移
- {
- delay(65000);
- for(c=0;c<=8;c++)
- {
- for(b=0;b<16;b++)
- {
- p2=taba[b];
- delay(125);
- }
- p0=tabb[c];
- p1=tabb[c];
- delay(2000);
- }
- for(c=0;c<=8;c++)
- {
- for(b=0;b<16;b++)
- {
- p2=taba[b];
- delay(125);
- }
- p0=tabd[c];
- p1=tabd[c];
- delay(800);
- }
- }
- }
- void delayi()
- {
- for(d=0;d<120;d++)
- {
- p0=0x01;
- p1=0x01;
- for(b=0;b<=8;b++)
- {
- p2=taba[15-j];
- p0=_cror_(p0,1);
- p1=_cror_(p0,1);
- delay(200);
- }
- p0=0x01;
- p1=0x01;
- for(b=0;b<=8;b++)
- {
- p2=taba[j];
- p0=_cror_(p0,1);
- p1=_cror_(p0,1);
- delay(200);
- }
- }
- for(a=0;a<200;a++)
- {
- p0=0x01;
- p1=0x01;
- for(b=0;b<=8;b++)
- {
- p2=taba[j];
- p0=_crol_(p0,1);
- p1=_crol_(p0,1);
- delay(200);
- }
- }
- for(a=0;a<200;a++)
- {
- p0=0x3f;
- p1=0x3f;
- for(b=0;b<=8;b++)
- {
- p2=taba[j];
- p0=_cror_(p0,1);
- p1=_cror_(p0,1);
- delay(200);
- }
- }
- for(a=0;a<200;a++)
- {
- p0=0x01;
- p1=0x01;
- for(b=0;b<=8;b++)
- {
- p2=taba[15-j];
- p0=_cror_(p0,1);
- p1=_cror_(p0,1);
- delay(200);
- }
- }
- for(b=0;b<80;b++) //星光璀璨
- {
- for(a=0;a<15;a++)
- {
- p0=tabc[e];
- p1=tabc[e];
- p2=taba[j];
- delay(450);
- }
- }
- }
- void delayj()
- {
- for(a=0;a<200;a++)
- {
- p0=0x33;
- p1=0x33;
- for(b=0;b<=8;b++)
- {
- p2=taba[j];
- p0=_crol_(p0,1);
- p1=_crol_(p0,1);
- delay(200);
- }
- }
- for(a=0;a<200;a++)
- {
- p0=0x33;
- p1=0x33;
- for(b=0;b<=8;b++)
- {
- p2=taba[j];
- p0=_cror_(p0,1);
- p1=_cror_(p0,1);
- delay(200);
- }
- }
- }
復制代碼
|