标题: diy广州小蛮腰 广州灯塔 单片机仿真及其程序 最美diy [打印本页]

作者: 啊啊大手大脚    时间: 2016-4-22 21:02
标题: diy广州小蛮腰 广州灯塔 单片机仿真及其程序 最美diy
这是我的一个广州灯塔的制作

程序仿真资料(压缩包)下载: 程序 仿真图.rar (92 KB, 下载次数: 248)
制作教程: 跟风模仿广州塔,最美LEDDIY.rar (1.04 MB, 下载次数: 251)

小蛮腰的仿真电路图:




单片机小蛮腰的制作过程:


单片机广州小蛮腰灯塔的程序:
  1. #include <AT89X51.H>
  2. #include <intrins.h>
  3. #define uchar unsigned char
  4. #define uint unsigned int
  5. #define p0 P0
  6. #define p1 P1
  7. #define p2 P2
  8. #define p3 P3
  9. uchar taba[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
  10.               0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
  11. uchar tabc[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
  12. uchar tabb[]={0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff};
  13. uchar tabd[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00};
  14. uchar a,b,c,d,e,f,g,h,i,j,k,l;
  15. void delaya();
  16. void delayb();
  17. void delayc();
  18. void delayd();
  19. void delaye();
  20. void delayf();
  21. void delayg();
  22. void delayh();
  23. void delayi();
  24. void delayj();
  25. void delay(unsigned int z)
  26. {
  27.         while(z--);
  28. }
  29. void main()
  30. {      
  31.    TMOD=0x11;
  32.    TH0=(65536-2000)/256;
  33.    TL0=(65536-2000)%256;
  34.    TH1=(65536-10000)/256;
  35.    TL1=(65536-10000)%256;
  36.    ET0=1;
  37.    TR0=1;
  38.    ET1=1;
  39.    TR1=1;
  40.    EA=1;
  41.         while(1)
  42.   {
  43.     delaya();
  44.     delayb();          
  45.     delayc();       
  46.     delayd();
  47.     delaye();
  48.     delayf();
  49.     delayg();
  50.     delayh();  
  51.     delayi();
  52. delayj();
  53.          }
  54.         }
  55. void li1() interrupt 1
  56. {
  57.    TH0=(65536-2000)/256;
  58.    TL0=(65536-2000)%256;
  59.         i++;
  60.         if(i==5) i=0;j++;
  61.         if(j==16) j=0;
  62.         }
  63. void li2() interrupt 3
  64. {
  65.    TH1=(65536-10000)/256;
  66.    TL1=(65536-10000)%256;
  67.    h++;
  68.         if(h==50) h=0;e++;l++;
  69.    if(e==8)  e=0;          
  70.    if(l==16) l=0;
  71.         }
  72. void delaya()
  73.    {
  74. for(c=0;c<3;c++)//下移
  75.   {        
  76.    p0=0xff;p1=0xff;
  77.    for(a=0;a<16;a++)
  78.           {
  79.           p2=taba[a];
  80.           delay(6000);
  81.           }       
  82.    }
  83. for(c=0;c<3;c++)//上移
  84.   {
  85.     p0=0xff;p1=0xff;       
  86.    for(a=0;a<16;a++)
  87.           {
  88.           p2=taba[15-a];
  89.           delay(6000);
  90.           }       
  91.    }
  92. for(c=0;c<3;c++)//上移和下移一起
  93.   {
  94.     p0=0xff;p1=0xff;       
  95.    for(a=0;a<16;a++)
  96.           {
  97.           p2=taba[16-a];
  98.           delay(4000);
  99.           p2=taba[a];
  100.           delay(4000);
  101.           }       
  102.    }
  103. for(a=0;a<200;a++)
  104.    {
  105.           p0=0x01;
  106.           p1=0x01;
  107.          for(b=0;b<=8;b++)
  108.          {
  109.                    p2=taba[15-j];
  110.                 p0=_crol_(p0,1);
  111.                 p1=_crol_(p0,1);
  112.            delay(200);
  113.                 }
  114.         }
  115. }
  116. void delayb()
  117.   {
  118.     for(a=0;a<8;a++)
  119.           {
  120.     for(g=0;g<16;g++)
  121.           {
  122.             p1=0x00;
  123.               p2=taba[g];  
  124.             p0=tabc[a];
  125.             delay(3000);
  126.                   }
  127.                     for(g=0;g<16;g++)
  128.                   {
  129.                  p2=taba[g];
  130.             p0=0x00;
  131.                  p1=tabc[a];
  132.        delay(3000);               
  133.       }
  134.          }
  135. for(a=0;a<200;a++)
  136.    {
  137.           p0=0x3f;
  138.           p1=0x3f;
  139.          for(b=0;b<=8;b++)
  140.          {
  141.                    p2=taba[j];
  142.                 p0=_crol_(p0,1);
  143.                 p1=_crol_(p0,1);
  144.            delay(200);
  145.                 }
  146.         }
  147.                  for(a=0;a<20;a++)//右移
  148.   {
  149.    for(c=0;c<=8;c++)
  150.         {
  151.     for(b=0;b<16;b++)
  152.          {
  153.     p2=taba[b];
  154.          delay(125);
  155.          }
  156.          p0=tabc[8-c];
  157.         p1=tabc[8-c];
  158.         delay(1000);
  159.    }
  160.         }
  161. }
  162. void delayc()
  163. {
  164.     for(a=0;a<2;a++)
  165.            {
  166.         for(g=0;g<=16;g++)
  167.                    {
  168.                          if(g<8)
  169.                          {
  170.                     p1=0x00;
  171.                       p2=taba[g];  
  172.                     p0=tabb[g];
  173.                     delay(4000);
  174.                          p2=taba[g];
  175.                     p0=0x00;
  176.                          p1=tabb[g];
  177.                delay(4000);
  178.                           }
  179.                        if(g>=8)
  180.                            {
  181.                          p1=0x00;
  182.                       p2=taba[g];  
  183.                     p0=tabb[g-8];
  184.                     delay(4000);
  185.                          p2=taba[g];
  186.                     p0=0x00;
  187.                          p1=tabb[g-8];
  188.                delay(4000);       
  189.                                 }
  190.                          }
  191.         }
  192. for(a=0;a<200;a++)
  193.    {
  194.           p0=0x01;
  195.           p1=0x01;
  196.          for(b=0;b<=8;b++)
  197.          {
  198.                    p2=taba[j];
  199.                 p0=_cror_(p0,1);
  200.                 p1=_cror_(p0,1);
  201.            delay(200);
  202.                 }
  203.         }
  204. for(f=0;f<2;f++)
  205.   {
  206. for(g=0;g<=16;g++)
  207.           {
  208.   if(g<8)
  209.            {
  210.                  p2=taba[g];
  211.             p1=0x00;
  212.                  p0=tabb[g];
  213.        delay(8000);
  214.            }
  215.           if(g>=8)
  216.            {
  217.                  p2=taba[g];
  218.                  p1=tabb[g-8];
  219.        delay(8000);       
  220.                 }  
  221.          }
  222.          }
  223.       for(b=0;b<80;b++)
  224.   {
  225.    for(a=0;a<15;a++)
  226.    {
  227.             p0=tabc[l];
  228.                 p1=tabc[l];
  229.                 p2=taba[j];
  230.                 delay(600);
  231.    }
  232.   }
  233. }
  234. void delayd()
  235. {          
  236. for(a=0;a<=8;a++)
  237.           {
  238.     for(g=0;g<=16;g++)
  239.           {
  240.             p1=0x00;
  241.               p2=taba[g];  
  242.             p0=tabb[a];
  243.             delay(2500);
  244.                  p2=taba[g];
  245.             p0=0x00;
  246.                  p1=tabb[a];
  247.        delay(2500);       
  248.                     }
  249.     }             
  250.   for(a=0;a<=8;a++)
  251.           {
  252.     for(g=0;g<=16;g++)
  253.           {
  254.             p1=0x00;
  255.               p2=taba[16-g];  
  256.             p0=tabb[a];
  257.             delay(2500);
  258.                  p2=taba[16-g];
  259.             p0=0x00;
  260.                  p1=tabb[a];
  261.        delay(2500);       
  262.                     }
  263.     }   
  264. for(b=0;b<120;b++)
  265.   {
  266.    for(a=0;a<15;a++)
  267.    {
  268.             p0=tabc[l];
  269.                 p1=tabc[l];
  270.                 p2=taba[j];
  271.                 delay(200);
  272.    }
  273.   }
  274. }
  275. void delaye()
  276. {
  277. for(a=0;a<20;a++)//左移
  278.   {
  279.    for(c=0;c<8;c++)
  280.         {
  281.     for(b=0;b<16;b++)
  282.          {
  283.     p2=taba[b];
  284.          delay(125);
  285.          }
  286.          p0=tabc[c];
  287.         p1=tabc[c];
  288.         delay(1000);
  289.    }
  290.         }
  291. for(c=0;c<3;c++)//上移和下移一起
  292.   { p0=0xff;p1=0xff;       
  293.    for(a=0;a<16;a++)
  294.           {
  295.           p2=taba[16-a];
  296.           delay(4000);
  297.           p2=taba[a];
  298.           delay(4000);
  299.           }       
  300.    }
  301. }
  302. void delayf()
  303. {
  304. for(a=0;a<=8;a++)
  305.           {
  306.    for(g=0;g<=16;g++)
  307.           {
  308.             p1=0x00;
  309.               p2=taba[16-g];  
  310.             p0=tabb[8-a];
  311.             delay(2500);
  312.                  p2=taba[16-g];
  313.             p0=0x00;
  314.                  p1=tabb[8-a];
  315.        delay(2500);       
  316.                     }   
  317.    }
  318.           for(b=0;b<80;b++)
  319.   {
  320.    for(a=0;a<15;a++)
  321.    {
  322.             p0=tabc[l];
  323.                 p1=tabc[l];
  324.                 p2=taba[j];
  325.                 delay(450);
  326.    }
  327.   }
  328. }
  329. void delayg()
  330. {
  331. for(b=0;b<120;b++)
  332.   {
  333.    for(a=0;a<15;a++)
  334.    {
  335.             p0=tabc[8-e];
  336.                 p1=tabc[8-e];
  337.                 p2=taba[15-j];
  338.                 delay(150);
  339.    }
  340.   }
  341. for(d=0;d<120;d++)
  342. {
  343.           p0=0x01;
  344.           p1=0x01;
  345.          for(b=0;b<=8;b++)
  346.          {
  347.                    p2=taba[15-j];
  348.                 p0=_crol_(p0,1);
  349.                 p1=_crol_(p0,1);
  350.            delay(200);
  351.                 }
  352.           p0=0x01;
  353.           p1=0x01;
  354.          for(b=0;b<=8;b++)
  355.          {
  356.                    p2=taba[j];
  357.                 p0=_crol_(p0,1);
  358.                 p1=_crol_(p0,1);
  359.            delay(200);
  360.         }
  361. }
  362. for(c=0;c<3;c++)//由中间向两边移动
  363.   {
  364.     p0=0xff;
  365.          p1=0xff;
  366.           for(a=8;a<16;a++)
  367.          {
  368.           p2=taba[a];
  369.           delay(4000);
  370.           p2=taba[16-a];
  371.           delay(4000);
  372.          }
  373.   }
  374. for(a=0;a<200;a++)
  375.    {
  376.           p0=0x3f;
  377.           p1=0x3f;
  378.          for(b=0;b<=8;b++)
  379.          {
  380.                    p2=taba[15-j];
  381.                 p0=_cror_(p0,1);
  382.                 p1=_cror_(p0,1);
  383.            delay(200);
  384.                 }
  385.         }
  386. for(b=0;b<80;b++)
  387.   {
  388.    for(a=0;a<15;a++)
  389.    {
  390.             p0=tabc[e];
  391.                 p1=tabc[e];
  392.                 p2=taba[j];
  393.                 delay(600);
  394.    }
  395.   }
  396. }
  397. void delayh()
  398. {
  399. for(a=0;a<2;a++)//左移
  400.   {
  401.     delay(65000);
  402.          for(c=0;c<=8;c++)
  403.         {
  404.     for(b=0;b<16;b++)
  405.          {
  406.     p2=taba[b];
  407.          delay(125);
  408.          }
  409.          p0=tabb[c];
  410.         p1=tabb[c];
  411.         delay(2000);                 
  412.         }
  413.   for(c=0;c<=8;c++)
  414.         {
  415.     for(b=0;b<16;b++)
  416.          {
  417.     p2=taba[b];
  418.          delay(125);
  419.          }
  420.          p0=tabd[c];
  421.          p1=tabd[c];
  422.          delay(800);          
  423.     }
  424.    }
  425. }
  426. void delayi()
  427. {
  428. for(d=0;d<120;d++)
  429. {
  430.           p0=0x01;
  431.           p1=0x01;
  432.          for(b=0;b<=8;b++)
  433.          {
  434.                    p2=taba[15-j];
  435.                 p0=_cror_(p0,1);
  436.                 p1=_cror_(p0,1);
  437.            delay(200);
  438.                 }
  439.           p0=0x01;
  440.           p1=0x01;
  441.          for(b=0;b<=8;b++)
  442.          {
  443.                    p2=taba[j];
  444.                 p0=_cror_(p0,1);
  445.                 p1=_cror_(p0,1);
  446.            delay(200);
  447.         }
  448. }
  449. for(a=0;a<200;a++)
  450.    {
  451.           p0=0x01;
  452.           p1=0x01;
  453.          for(b=0;b<=8;b++)
  454.          {
  455.                    p2=taba[j];
  456.                 p0=_crol_(p0,1);
  457.                 p1=_crol_(p0,1);
  458.            delay(200);
  459.                 }
  460.         }       
  461. for(a=0;a<200;a++)
  462.    {
  463.           p0=0x3f;
  464.           p1=0x3f;
  465.          for(b=0;b<=8;b++)
  466.          {
  467.                    p2=taba[j];
  468.                 p0=_cror_(p0,1);
  469.                 p1=_cror_(p0,1);
  470.            delay(200);
  471.                 }
  472.         }
  473. for(a=0;a<200;a++)
  474.    {
  475.           p0=0x01;
  476.           p1=0x01;
  477.          for(b=0;b<=8;b++)
  478.          {
  479.                    p2=taba[15-j];
  480.                 p0=_cror_(p0,1);
  481.                 p1=_cror_(p0,1);
  482.            delay(200);
  483.                 }
  484.         }
  485. for(b=0;b<80;b++)   //星光璀璨
  486.   {
  487.    for(a=0;a<15;a++)
  488.    {
  489.             p0=tabc[e];
  490.                 p1=tabc[e];
  491.                 p2=taba[j];
  492.                 delay(450);
  493.    }
  494.   }
  495. }
  496. void delayj()
  497. {

  498. for(a=0;a<200;a++)
  499.    {
  500.           p0=0x33;
  501.           p1=0x33;
  502.          for(b=0;b<=8;b++)
  503.          {
  504.                    p2=taba[j];
  505.                 p0=_crol_(p0,1);
  506.                 p1=_crol_(p0,1);
  507.            delay(200);
  508.                 }
  509.         }
  510. for(a=0;a<200;a++)
  511.    {
  512.           p0=0x33;
  513.           p1=0x33;
  514.          for(b=0;b<=8;b++)
  515.          {
  516.                    p2=taba[j];
  517.                 p0=_cror_(p0,1);
  518.                 p1=_cror_(p0,1);
  519.            delay(200);
  520.                 }
  521.         }
  522.         }
复制代码




作者: llouba    时间: 2016-4-27 08:42
楼主制作灯塔需要哪些材料
作者: 谭雅Ayom    时间: 2016-5-15 11:37
楼主  需要准备哪些元器件?
作者: 花开半夏    时间: 2016-10-16 09:16
楼主,有PCB电路图吗
作者: robin_chen559    时间: 2016-10-17 18:10
恩 挺漂亮的 顶一个~~~
作者: 小志电子    时间: 2016-10-22 20:10
16*16点阵图是怎么连到锁存器上的
作者: 小志电子    时间: 2016-10-22 23:51
谭雅Ayom 发表于 2016-5-15 11:37
楼主  需要准备哪些元器件?

我也想知道,同求
作者: 爱小莉    时间: 2016-11-6 23:42
下载来做一个
作者: 咆哮的阿杰    时间: 2016-11-27 23:00
楼主还在吗?你能说下二极管的引脚的折法吗
作者: 梦回冉末    时间: 2016-11-29 11:41
多色就更好了嗷
作者: qq195182696    时间: 2016-12-19 16:02
支持一下。。
作者: 白菜帮    时间: 2016-12-22 18:57
支持一下
加油!!!
作者: yuanleiping    时间: 2016-12-29 10:30
谢谢楼主的支持,对我非常有用
作者: 懒惰的魔方    时间: 2017-1-14 21:28
楼主真是牛的不行,新手膜拜..
作者: 18819492470    时间: 2017-3-22 19:26
新手膜拜..
作者: wangyue    时间: 2017-4-6 09:13
up,顶一下
作者: wangyue    时间: 2017-4-6 09:14
比较好的diy制作,可以看下偶
作者: ytyjyj    时间: 2017-4-20 22:23
学习了。。。。
作者: arsheng    时间: 2017-4-25 15:45
好厲害的工藝~
作者: pan984730281    时间: 2017-5-11 20:51
正需要 ,  谢谢。
作者: 陌雨烟1    时间: 2017-5-12 14:26
谢谢分享!!!
作者: 1025777693    时间: 2017-5-25 09:47
很好  我喜欢   但是我不会制作啊
作者: 131313ll    时间: 2017-5-29 10:56
谢谢分享!
作者: kawenlong    时间: 2017-6-18 02:03
谢谢分享!!!

作者: 距离感    时间: 2017-7-17 12:44
二极管接的很漂亮!
作者: 海飞    时间: 2017-9-21 20:38
很给力,如果资料更详细一点就更好了
作者: qzyhlf    时间: 2017-9-22 14:58

楼主,有PCB电路图吗
作者: liu12345678    时间: 2017-10-27 18:12
很不错,现在正在试着做一个
作者: jqx    时间: 2017-11-21 18:40
怎么做的
作者: 零下72度的坚强    时间: 2017-11-27 21:18
非常强

作者: mochi    时间: 2017-11-28 16:11
楼主,有PCB电路图吗
作者: 544973007    时间: 2018-1-1 20:20
手机下载了怎么打不开
作者: wyj841224    时间: 2018-1-2 10:34
好厉害呀,51单片机也可以做广东塔呀。
作者: a8238712    时间: 2018-1-18 09:30
楼主很强大!!!
作者: 仰望星空111    时间: 2018-3-18 20:12
怎么做的,求楼主分享,谢谢。
作者: kaixinyk    时间: 2018-4-1 16:32
楼主很牛
作者: 15657863236    时间: 2018-4-11 23:07
好厉害,学习学习
作者: 15657863236    时间: 2018-4-11 23:09
厉害厉害,学习
作者: 晨露嫣然    时间: 2018-4-14 17:53
今天做了一个!挺好!
作者: kaixinyk    时间: 2018-4-26 10:40
精彩,51hei需要你。
作者: somnusx    时间: 2018-4-26 14:35
厉害了我的哥
作者: ZJR001    时间: 2018-4-30 01:23
感谢分享51黑需要你
作者: pcb123    时间: 2018-5-25 09:53
楼主你太厉害啦
作者: 玛丽莲萌鹿953    时间: 2018-6-3 13:11
膜拜膜拜楼主强大
作者: tttt12    时间: 2018-7-4 12:48
怎么下载不了啊
作者: ztttth    时间: 2018-11-20 07:35
谢谢楼主分享!下载一下,试着做一个
作者: yzhbyyy    时间: 2019-4-30 09:35
学习了。。。。
作者: 张玲莉    时间: 2019-12-17 16:10
好东西,借用
作者: perseverance51    时间: 2020-9-20 23:26
复制过来的代码编译出错,
作者: ojos    时间: 2020-10-6 10:40
顶一个  想要焊接过程
作者: pxh316    时间: 2021-4-27 18:34
这个做得很好,有实物有仿真,有源程序是学习单片机新手的福声,真的谢谢楼主!
作者: caicaicacainiao    时间: 2021-6-11 23:30
很好,一直想做个灯塔来着。




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1