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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > C51算術(shù)運(yùn)算符練習(xí)

          C51算術(shù)運(yùn)算符練習(xí)

          作者: 時(shí)間:2016-11-11 來源:網(wǎng)絡(luò) 收藏
          /*
          *位定義實(shí)現(xiàn)3個(gè)LED的點(diǎn)亮
          *李欽焰2011.12.01
          */
          #include

          #defineON 0
          #defineOFF 1

          sbit led1=P1^0;
          sbit led2=P1^2;
          sbit led3=P1^5;

          main()
          {
          bit a;
          a=ON;

          led1=led2=led3=a;
          while(1);
          }



          /*
          * char變量的用法
          *李欽焰
          * 2011.12.01
          */
          #include

          #define uncharunsigned char

          main()
          {
          unchar led;
          led=0x55;

          P1=led;
          while(1);
          }


          /*
          * *的使用
          *李欽焰
          * 2011.12.01
          */
          #include

          #define uncharunsigned char

          main()
          {
          unchar led;
          led=0x00+1*8;

          P1=led;
          while(1);
          }



          /*
          *復(fù)合賦值運(yùn)算符的使用
          *李欽焰
          * 2011.12.01
          */
          #include

          #define uncharunsigned char
          #define led6(1<<6)

          main()
          {
          /*unchar led = 0;
          led |= led6 ;//置位
          */
          unchar led=0xff;
          led&=~led6;

          P1=led;
          while(1);
          }


          /*
          * +的使用
          *李欽焰
          * 2011.12.01
          */
          #include

          #define uncharunsigned char

          main()
          {
          unchar led;
          led=0x00+0xE0;

          P1=led;
          while(1);
          }


          /*
          * %的使用
          *李欽焰
          * 2011.12.01
          */
          #include

          #define uncharunsigned char

          main()
          {
          unchar led;
          led=66%5;

          P1=led;
          while(1);
          }


          /*
          * <<的使用
          *李欽焰
          * 2011.12.01
          */
          #include

          #define uncharunsigned char

          main()
          {
          unchar led;
          led=0xFF>>3;

          P1=led;
          while(1);
          }


          /*
          * &的使用
          *李欽焰
          * 2011.12.01
          */
          #include

          #define uncharunsigned char

          main()
          {
          unchar led;
          led=0x55&0xAA;

          P1=led;
          while(1);
          }


          關(guān)鍵詞: C51算術(shù)運(yùn)算

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