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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 單片機(jī)驅(qū)動(dòng)16*16點(diǎn)陣LED漢字顯示c51程序

          單片機(jī)驅(qū)動(dòng)16*16點(diǎn)陣LED漢字顯示c51程序

          作者: 時(shí)間:2012-12-05 來源:網(wǎng)絡(luò) 收藏

          //=========================================
          //******* 驅(qū)動(dòng)16*16c51程序 *******
          //******* 作者:http://www.51hei.com *******
          //=========================================
          //晶振12MHz
          //P1.0~P1.3接74154行掃描
          //P3.0、P3.1接74164串轉(zhuǎn)并
          #include reg51.h>
          #define uchar unsigned char
          #define uint unsigned int

          uchar int_t;
          uchar i;
          uchar j;
          uchar count=2; //2個(gè)字
          uint k=0;

          void t0_int() interrupt 1
          {
          TL0=0x18;
          TH0=0x1C;
          int_t++;
          if(int_t==2) //移動(dòng)速度2ms
          {
          int_t=0;
          k=k+2;
          if(k==count*32)
          k=0;
          }
          }

          void delay(uint dt)//2字節(jié)
          {
          uchar bt;//1字節(jié)
          for (;dt;dt--)
          {
          for (bt=0;bt255;bt++);
          }
          }

          void serial_send(uchar dat)
          {
          SCON=0x00;
          SBUF=~dat;
          while(1){ if(TI) {TI=0;break;} }
          }

          unsigned char code hzdot[64] = {
          /*測(cè) CB2E2 */
          0x40,0x02,0x27,0xC2,0x24,0x42,0x84,0x52,0x45,0x52,0x55,0x52,0x15,0x52,0x25,0x52,
          0x25,0x52,0x25,0x52,0xC5,0x52,0x41,0x02,0x42,0x82,0x42,0x42,0x44,0x4A,0x48,0x04,

          /*試 CCAD4 */
          0x00,0x20,0x40,0x28,0x20,0x24,0x30,0x24,0x27,0xFE,0x00,0x20,0xE0,0x20,0x27,0xE0,
          0x21,0x20,0x21,0x10,0x21,0x10,0x21,0x0A,0x29,0xCA,0x36,0x06,0x20,0x02,0x00,0x00

          };

          void display()
          {
          j=k;
          for(i=0;i16;i++)
          {
          P1=i;
          serial_send(hzdot[j]);
          j++;
          serial_send(hzdot[j]);
          j++;
          if(j==count*32)
          j=0;
          delay(1);
          }
          }

          void main()
          {
          SCON=0x00;
          TMOD=0x01;
          IE|=0x82;
          TL0=0x18;
          TH0=0x1C;
          delay(100);
          TR0=1; //啟動(dòng)T0定時(shí)器
          for(;;)
          display();
          }



          評(píng)論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁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); })();