<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 單片機程序-點陣LED顯示I LVOE U

          單片機程序-點陣LED顯示I LVOE U

          作者: 時間:2016-12-02 來源:網(wǎng)絡 收藏
          本程序所用的原理圖下載:點這里,單片機芯片使用的stc89c52;找到點陣部分的原理圖即可.這是一整個單片機開發(fā)板的電路圖其他的忽略

          一下是程序源碼:
          /******點陣LED顯示I LVOE U**************/
          /**
          *功能:點陣LED延時一秒顯示I 心形 U(I LOVE YOU)
          *作者:徐冉
          *日期:2013-06-12
          *備注:程序順利調(diào)試成功
          **/
          /*************AT89C52-RC MCU*******************/
          /**************51hei開發(fā)板********************/
          #include
          typedef unsigned int uint;
          typedef unsigned char uchar;
          sbit din = P2^0;//數(shù)據(jù)輸入端
          sbit cs = P2^1;//片選端
          sbit clk = P2^2; //時鐘信號端
          //字模取模編碼
          uchar code dis[][8] = {
          {0x00,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00},// I
          {0x00,0x6C,0xFE,0xFE,0x7C,0x38,0x10,0x00}, // 心形
          {0x00,0xC3,0xC3,0xC3,0xC3,0xC3,0x7E,0x3C} // U
          };
          //delay:xms
          void delay(uint xms)
          {
          uint x, y;
          for(x = 0; x < xms; x++)
          for(y = 0; y < 110; y++);
          }
          //寫MAX7219字節(jié)
          void write_byte(uchar dat)
          {
          uchar i = 0;
          cs = 0;
          for(i = 0; i < 8; i++)
          {
          clk = 0;
          din = (dat & 0x80);
          dat <<= 1;
          clk = 1;
          }
          }
          //寫入MAX7219數(shù)據(jù)
          void write_max7219(uchar address, uchar date)
          {
          cs = 0;
          write_byte(address);//寫地址
          write_byte(date); //寫入數(shù)據(jù)
          cs = 1;
          }
          //MAX7219初始化
          void max7219_init()
          {
          write_max7219(0x0c, 0x01);
          write_max7219(0x09, 0x00);
          write_max7219(0x0a, 0x04);
          write_max7219(0x0b, 0x07);
          write_max7219(0x0f, 0x00);
          }
          //主程序
          void main(void)
          {
          uchar i, j;
          max7219_init();
          while(1)
          {
          for(j = 0; j < 3; j++)
          {
          for(i = 0; i < 8; i++)
          {
          write_max7219(i+1, dis[j][i]);
          delay(1);
          }
          delay(1000);
          }
          }
          }

          本文引用地址:http://www.ex-cimer.com/article/201612/324601.htm


          關鍵詞: 單片機點陣LED顯

          評論


          技術專區(qū)

          關閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();