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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > LPC2103學(xué)習(xí)板-數(shù)碼管顯示

          LPC2103學(xué)習(xí)板-數(shù)碼管顯示

          作者: 時(shí)間:2016-11-18 來源:網(wǎng)絡(luò) 收藏

          數(shù)碼管部分 電路原理圖:

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

          其中TRS 和TMS使用了JTAG口,所以在調(diào)試的時(shí)候不能使用普通IO功能,需要程序燒寫進(jìn)入后,取消JTAG模式,才能正常工作。

          源程序:
          /**************ARM7(LPC2103)練習(xí)程序**************************/
          /*************************************************************/
          /*****File Function : 數(shù)碼管顯示 *****/
          /*****Program Author : ClimberWin *****/
          /*****MCU : LPC2103F 外部12M晶振 *****/
          /*****Compile Date : 2010/04/01 *****/
          /*****Edition Info : V1.0 *****/
          /*************************************************************/
          //編譯環(huán)境 KEIL for ARM
          //數(shù)據(jù)接口 P0.10-P0.17
          //選通端 P0.25 P0.26 P0.27 P0.28
          //蜂鳴器 P0.21
          //注:數(shù)碼管使用到JTAG引腳,所以運(yùn)行時(shí)候需要JTAG不使能才能做普通IO處理。不然只能2個(gè)數(shù)碼管選通
          #include
          #include
          #define uint unsigned int
          #define uchar unsigned char

          //#define speak (1<<21) //蜂鳴器引腳定義
          #define COM1 (1<<25) //定義數(shù)碼管1的選通引腳
          #define COM2 (1<<26) //定義數(shù)碼管2的選通引腳
          #define COM3 (1<<27) //定義數(shù)碼管3的選通引腳
          #define COM4 (1<<28) //定義數(shù)碼管4的選通引腳

          void delayms(unsigned int count);//延時(shí)程序
          void led_display(void);//顯示程序
          uchar LED_DATA[16]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x88,0x83,0xC6,0xA1,0x86,0x8E};
          /*************延時(shí)程序***************/
          void delayms(unsigned int count)
          {
          unsigned int i,j;
          for(i=0;ifor(j=0;j<1000;j++);
          }
          void led_display(void)
          {
          float led_data;
          IO0CLR=0xffffffff;
          led_data=LED_DATA[4]<<10;
          IO0SET=led_data;
          IO0CLR=COM1;
          IO0SET=COM2;
          IO0SET=COM3;
          IO0SET=COM4;
          delayms(50);
          IO0CLR=0xffffffff;
          led_data=LED_DATA[3]<<10;
          IO0SET=led_data;
          IO0CLR=COM2;
          IO0SET=COM1;
          IO0SET=COM3;
          IO0SET=COM4;
          delayms(50);
          IO0CLR=0xffffffff;
          led_data=LED_DATA[2]<<10;
          IO0SET=led_data;
          IO0CLR=COM3;
          IO0SET=COM2;
          IO0SET=COM1;
          IO0SET=COM4;
          delayms(50);
          IO0CLR=0xffffffff;
          led_data=LED_DATA[1]<<10;
          IO0SET=led_data;
          IO0CLR=COM4;
          IO0SET=COM1;
          IO0SET=COM2;
          IO0SET=COM3;
          delayms(50);
          }
          /////////////主程序///////////////////
          void main(void)
          {
          PINSEL0 |= 0x00000000;
          PINSEL1 |= 0x00000000;
          IO0DIR=0x1e03fc00; //配置P0.10-P0.17 P0.25 P0.26 P0.27 P0.28為輸出
          while(1)
          {
          led_display();
          }
          }



          關(guān)鍵詞: LPC2103數(shù)碼管顯

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