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

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

        LED8X8點陣顯示數字0-9數字

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

        下面是電路圖:


         /* 名稱:8X8LED點陣顯示數字
         說明:1.8X8LED點陣屏循環顯示數字0~9,刷新過程為動態變換完成。
                    2.行掃描為XX,接P1口,列掃描為YY,接P3口
        */
        #include<reg51.h>
        #include<intrins.h>
        #define uchar unsigned char
        #define uint unsigned int
        uchar code XX[]=
        {
         0x00,0x3e,0x41,0x41,0x41,0x3e,0x00,0x00, //0
         0x00,0x00,0x00,0x21,0x7f,0x01,0x00,0x00, //1
         0x00,0x27,0x45,0x45,0x45,0x39,0x00,0x00, //2
         0x00,0x22,0x49,0x49,0x49,0x36,0x00,0x00, //3
         0x00,0x0c,0x14,0x24,0x7f,0x04,0x00,0x00, //4
         0x00,0x72,0x51,0x51,0x51,0x4e,0x00,0x00, //5
         0x00,0x3e,0x49,0x49,0x49,0x26,0x00,0x00, //6
         0x00,0x40,0x40,0x40,0x4f,0x70,0x00,0x00, //7
         0x00,0x36,0x49,0x49,0x49,0x36,0x00,0x00, //8
         0x00,0x32,0x49,0x49,0x49,0x3e,0x00,0x00  //9
        };
        uchar code YY[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
        uchar i,k,j,t=0,Num_Index;
        void yanchi(uchar ms)
        {
          while(ms--)
           {
            for (i=0;i<100;i++);
           }
        }
        //主程序
        void main()
        {
         while(1)
            {
            for(t=0;t<10;t++)
                  {
               for(j=0;j<50;j++)
                {
                  for(k=0;k<8;k++)
                   {
                    P1=YY[k];
                    P3=~XX[t*8+k];
                    yanchi(2);
                   }
                   }//**************************0
                  }
            }
        }
        /*******************************************************************************************/
        #include<reg51.h>
        #include<intrins.h>
        #define uchar unsigned char
        #define uint unsigned int
        uchar code XX[]=
        {
         0x00,0x3e,0x41,0x41,0x41,0x3e,0x00,0x00, //0
         0x00,0x00,0x00,0x21,0x7f,0x01,0x00,0x00, //1
         0x00,0x21,0x43,0x45,0x49,0x31,0x00,0x00, //2
         0x00,0x22,0x49,0x49,0x49,0x36,0x00,0x00, //3
         0x00,0x0c,0x14,0x24,0x7f,0x04,0x00,0x00, //4
         0x00,0x72,0x51,0x51,0x51,0x4e,0x00,0x00, //5
         0x00,0x3e,0x49,0x49,0x49,0x26,0x00,0x00, //6
         0x00,0x40,0x40,0x4f,0x50,0x60,0x00,0x00, //7
         0x00,0x36,0x49,0x49,0x49,0x36,0x00,0x00, //8
         0x00,0x32,0x49,0x49,0x49,0x3e,0x00,0x00  //9
        };
        uchar code YY[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
        uint i,k,j,t;
        void yanchi(uchar ms)
        {
          while(ms--)
           {
            for (i=0;i<100;i++);
           }
        }
        //主程序
        void main()
        {
         while(1)
            {
            for(t=0;t<200;t++)
                  {
               for(j=0;j<20;j++)
                {
                  for(k=0;k<8;k++)
                   {
                    P1=YY[k];
                    P2=~XX[(t%10)*8+k];
                             P3=~XX[((t%100)/10)*8+k];
                             P0=~XX[(t/100)*8+k];
                    yanchi(2);
                   }
                }//**************************0
                  }
            }

         
        關閉窗口

        相關文章

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