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

          新聞中心

          初學(xué)STM32--建立工程

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



          因?yàn)槲业氖莝tm32f103vet6是大容量(512k),所以選擇 hd.s (h是高密度)









          雙擊main.c函數(shù)在里面加入以下程序代碼:(一定要認(rèn)真,小數(shù)點(diǎn)也不許錯(cuò)呀?。?p>

          //GPIO操作,完成簡(jiǎn)單的IO操作,用按鍵控制LED閃爍

          #include "stm32f10x.h"
          GPIO_InitTypeDef GPIO_InitStructure;
          //LED初始化
          void LED_Init(void)
          {
          RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD,ENABLE);
          GPIO_InitStructure.GPIO_Pin=GPIO_Pin_5;

          GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
          GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
          GPIO_Init(GPIOD,&GPIO_InitStructure);
          }
          //延遲函數(shù)

          void Delay(vu32 uCount)
          {
          for(;uCount!=0;uCount--);
          }

          //時(shí)鐘函數(shù)
          void RCC_Configuration(void)
          {
          SystemInit();
          }

          //主函數(shù)
          intmain(void)
          {
          RCC_Configuration();
          LED_Init();
          while(1)
          {
          GPIO_SetBits(GPIOD,GPIO_Pin_5);
          Delay(0x8ffff);
          GPIO_ResetBits(GPIOD,GPIO_Pin_5);
          Delay(0x8ffff);
          }
          }

          加入以后點(diǎn)擊工具欄里的“魔法棒”設(shè)置如下;


          這里設(shè)置比較重要,

          在Define里輸入:USE_STDPERIPH_DRIVER,STM32F10X_HD

          后面的STM32F10X_HD是我的對(duì)應(yīng)的

          在Include Paths 找到相應(yīng)的所有的頭文件:..cmsis和 ..startup和..user和..inc



          關(guān)鍵詞: 初學(xué)STM32建立工

          評(píng)論


          技術(shù)專(zhuān)區(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); })();