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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應用 > 在ARM 中 GPIO的設(shè)置方法

          在ARM 中 GPIO的設(shè)置方法

          作者: 時間:2016-11-20 來源:網(wǎng)絡(luò) 收藏
          //LPC2103,周立功公司的ARM產(chǎn)品。

          //在此處,每行未,使用了一個反斜,表示,上下行

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

          //為一個整體,這樣寫方便修改和理解,設(shè)定。

          //沒寫完,要注意。以后,多引用這種方法。

          // PINSEL1 = PINSEL1 & (~(0x03 << 2)|~(0x3<<4)|~(0x3<<6));//錯誤 置0用&而不是用或的
          PINSEL1 = ( PINSEL1 // 在P0。0~P0。15后,劃入PINSEL1,每2位PINSEL

          //一個位; 而IO0DIR是一對1的。
          & (~(0x03 << 2) //設(shè)定P0。17
          &(~(0x3<<4)) // P0。18
          &(~(0x3<<6))));


          #include "config.h"

          # define LED1 1 << 17

          # define LED2 1 << 18

          # define LED3 1 << 19


          # define LEDCON LED1|LED2|LED3

          void DelayNS (uint32 uiDly)
          {
          uint32 i;

          for (; uiDly > 0; uiDly--){
          for(i = 0; i < 50000; i++);
          }
          }


          int main (void)
          {

          // PINSEL0|&= (~)
          uint32 k;

          PINSEL1=0xffffffff;

          //PINSEL1=0;

          // PINSEL1 = PINSEL1 & (~(0x03 << 2)|~(0x3<<4)|~(0x3<<6));

          PINSEL1 = PINSEL1 & (~(0x03 << 2));

          //置0用與,&=,置1用或|=
          //PINSEL1 |=( (~(0x03<<4)));// PINSEL1

          // PINSEL1 = PINSEL1 |(~(0x03 << 2)|~(0x3<<4));


          // PINSEL1 = PINSEL1 & (~(0x03 << 4));

          // PINSEL1 = PINSEL1 & (~(0x03 << 2)|~(0x3<<4)|~(0x3<<6));//錯誤 置0用&而不是用或的
          PINSEL1 = (PINSEL1 & (~(0x03 << 2)&(~(0x3<<4))&(~(0x3<<6))));

          k=PINSEL1;

          IO0DIR = LED1;

          IO0DIR |=LEDCON;



          IO0SET = LED1;




          while (1) {
          IO0SET = LED1;
          DelayNS(50);
          IO0CLR = LED1;
          DelayNS(50);

          IO0SET = LEDCON;
          DelayNS(50);
          IO0CLR = LEDCON;
          DelayNS(50);



          }

          return 0;
          }



          關(guān)鍵詞: ARMGPIO設(shè)置方

          評論


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