久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 9497|回復: 7
打印 上一主題 下一主題
收起左側

小蠻腰燈塔單片機設計 本質就是16X16的點陣

  [復制鏈接]
跳轉到指定樓層
樓主
用一塊at89c52單片機,一塊74HC154譯碼器。塔總共16層,每層16盞燈,層共陰,豎共陽,通俗來講,就是一塊16X16的點陣。
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)








單片機源程序:
  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. ……………………

  470. …………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼

所有資料51hei提供下載:
程序 仿真圖.rar (91.99 KB, 下載次數: 69)




分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏8 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:1 發表于 2017-11-21 00:38 | 只看該作者
好資料,51黑有你更精彩!!!
回復

使用道具 舉報

板凳
ID:233051 發表于 2017-11-28 09:20 | 只看該作者
好資料,51黑有你更精彩!!!
回復

使用道具 舉報

地板
ID:272378 發表于 2018-1-6 17:20 | 只看該作者
在嗎?可不可以該我的評論多3個黑幣有急用謝謝你了
回復

使用道具 舉報

5#
ID:272378 發表于 2018-1-6 17:28 | 只看該作者
好資料,51黑有你更精彩!!!
回復

使用道具 舉報

6#
ID:291276 發表于 2018-3-17 23:35 | 只看該作者

好資料,51黑有你更精彩!!!
回復

使用道具 舉報

7#
ID:299588 發表于 2018-4-19 10:22 來自手機 | 只看該作者
這個我我喜歡
回復

使用道具 舉報

8#
ID:258965 發表于 2018-6-19 15:43 | 只看該作者
不錯 很好看
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 欧美日韩亚洲在线 | 日韩中文字幕在线观看 | 亚洲视频一区在线播放 | 97免费在线观看视频 | 国产丝袜人妖cd露出 | 亚洲精品在线免费观看视频 | 国产午夜精品一区二区三区嫩草 | 午夜视频大全 | 男人天堂午夜 | 羞羞的视频免费在线观看 | 99精品一区 | 精品综合久久久 | 日韩精品一区二区三区四区视频 | 久久综合成人精品亚洲另类欧美 | 黄色网址在线免费播放 | 国产成人精品免费视频大全最热 | 中文字幕欧美日韩 | 国产美女精品视频免费观看 | 一a一片一级一片啪啪 | 毛片免费视频 | 久久精彩视频 | 久久国产亚洲 | 久草中文在线 | 免费久久久 | 日韩成人在线播放 | 九九伊人sl水蜜桃色推荐 | 成人在线中文字幕 | 亚洲精品资源 | 午夜合集 | 国产高清视频在线 | 国产乱码一区 | 亚洲精品免费在线观看 | 久久国产精品72免费观看 | 韩国成人在线视频 | 亚洲福利av | 国产精品久久久久久久久久久久久 | 亚洲精品v日韩精品 | 国产精品一区一区 | 日韩免费网站 | 欧美日韩国产一区 | 蜜桃黄网 |