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

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 單片機(jī)40個(gè)實(shí)驗(yàn)之廣告燈的左移右移

          單片機(jī)40個(gè)實(shí)驗(yàn)之廣告燈的左移右移

          作者: 時(shí)間:2016-12-02 來(lái)源:網(wǎng)絡(luò) 收藏


          每次送出的數(shù)據(jù)是不同,具體的數(shù)據(jù)如下表1所示 :


          P1.7

          P1.6

          P1.5

          P1.4

          P1.3

          P1.2

          P1.1

          P1.0

          說(shuō)明

          L8

          L7

          L6

          L5

          L4

          L3

          L2

          L1

          1

          1

          1

          1

          1

          1

          1

          0

          L1亮

          1

          1

          1

          1

          1

          1

          0

          1

          L2亮

          1

          1

          1

          1

          1

          0

          1

          1

          L3亮

          1

          1

          1

          1

          0

          1

          1

          1

          L4亮

          1

          1

          1

          0

          1

          1

          1

          1

          L5亮

          1

          1

          0

          1

          1

          1

          1

          1

          L6亮

          1

          0

          1

          1

          1

          1

          1

          1

          L7亮

          0

          1

          1

          1

          1

          1

          1

          1

          L8亮
          表1

          5.程序框圖

           

          6. 匯編源程序

          ORG 0
          START: MOV R2,#8
          MOV A,#0FEH
          SETB C
          LOOP: MOV P1,A
          LCALL DELAY
          RLC A
          DJNZ R2,LOOP
          MOV R2,#8
          LOOP1: MOV P1,A
          LCALL DELAY
          RRC A
          DJNZ R2,LOOP1
          LJMP START
          DELAY: MOV R5,#20 ;
          D1: MOV R6,#20
          D2: MOV R7,#248
          DJNZ R7,$
          DJNZ R6,D2
          DJNZ R5,D1
          RET
          END

          7.C語(yǔ)言源程序

          #include
          unsigned char i;
          unsigned char temp;
          unsigned char a,b;

          void delay(void)
          {
          unsigned char m,n,s;
          for(m=20;m>0;m--)
          for(n=20;n>0;n--)
          for(s=248;s>0;s--);
          }
          void main(void)
          {
          while(1)
          {
          temp=0xfe;
          P1=temp;
          delay();
          for(i=1;i<8;i++)
          {
          a=temp<b=temp>>(8-i);
          P1=a|b;
          delay();
          }
          for(i=1;i<8;i++)
          {
          a=temp>>i;
          b=temp<<(8-i);
          P1=a|b;
          delay();
          }
          }
          }

          上一頁(yè) 1 2 下一頁(yè)

          評(píng)論


          技術(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); })();