<acronym id="xonnx"></acronym>
      <td id="xonnx"></td>
    1. <pre id="xonnx"></pre>

      1. 專注電子技術學習與研究
        當前位置:單片機教程網 >> MCU設計實例 >> 瀏覽文章

        51單片機花樣流水燈程序

        作者:huqin   來源:本站原創   點擊數:  更新時間:2014年04月04日   【字體:

        在p0和p2口上各接8個led,能顯示出各種花樣,效果非常牛逼程序代碼如下
        #include<reg51.h>
        #define uchar unsigned char
        #define uint unsigned int
        uchar code Pattern_P0[]=
        {
        0xFC,0xF9,0xF3,0xE7,0xCF,0x9F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
        0xE7,0xD8,0xBD,0x7E,0xBD,0xDB,0xE7,0xFF,0xE7,0xC3,0x81,0x00,0x81,0xC3,0xE7,0xFF,
        0xAA,0x55,0x18,0xFF,0xF0,0x0F,0x00,0xFF,0xF8,0xF1,0xE3,0xC7,0x8F,0x1F,0x3F,0x7F,
        0x7F,0x3F,0x1F,0x8F,0xC7,0xE3,0xF1,0xF8,0xFF,0x00,0x00,0xFF,0xFF,0x0F,0xF0,0xFF,
        0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
        0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7E,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xEE,
        0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0xFB,0xFC,0xFE,
        0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xEF
        };
        uchar code Pattern_P2[]=
        {
        0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFC,0xF9,0xF3,0xE7,0xCF,0x9F,0x3F,0xFF,
        0xE7,0xD8,0xBD,0x7E,0xBD,0xDB,0xE7,0xFF,0xE7,0xC3,0x81,0x00,0x81,0xC3,0xE7,0xFF,
        0xAA,0x55,0x18,0xFF,0xF0,0x0F,0x00,0xFF,0xF8,0xF1,0xE3,0xC7,0x8F,0x1F,0x3F,0x7F,
        0x7F,0x3F,0x1F,0x8F,0xC7,0xE3,0xF1,0xF8,0xFF,0x00,0x00,0xFF,0xFF,0x0F,0xF0,0xFF,
        0xFE,0xFD,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,
        0x7F,0xBF,0xDE,0xEF,0xF7,0xFB,0xFD,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
        0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,
        0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
        0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF
        };
        void DelayMS(uint x)
        {
        uchar t;
        while(x--)for(t=0;t<120;t++);
        }
        void main()
        {
        uchar i;
        while(1)
        {
        for(i=0;i<136;i++)
        {
        P0=Pattern_P0[i];
        P2=Pattern_P2[i];
        DelayMS(150);
        }
        }
        }
        進行仿真實驗如下圖

        關閉窗口

        相關文章

        欧美性色欧美精品视频,99热这里只有精品mp4,日韩高清亚洲日韩精品一区二区,2020国自产拍精品高潮