1. 程式人生 > >【STM32F429開發日誌】+hello led(閃爍led燈)

【STM32F429開發日誌】+hello led(閃爍led燈)

拿到 STM32F429 Discovery kit 有一週了,萬事開頭難,現在啟動微控制器界的第一個 hello world 程式  也就是  hello led(閃爍led燈)
邁開探索429的第一步。
0)  用usb type A to mini B 線連線電腦和班子上的USB ST-LINK
1)下載stsw-stm32138.zip  解壓出 E:\stf429\STM32F429I-Discovery_FW_V1.0.1\Projects
2)用keil 開啟E:\stf429\STM32F429I-Discovery_FW_V1.0.1\Projects\Template\MDK-ARM下面的模板工程Template.uvproj
3)在main.c中新增程式碼如下:
void Delay(__IO uint32_t nTime)

 
  while(--nTime != 0);
}
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       files (startup_stm32f429_439xx.s) before to branch to application main. 
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f4xx.c file
     */  
  
  /* Add your application code here */
     STM_EVAL_LEDInit(LED4);
  /* Infinite loop */
  while (1)
  {
                STM_EVAL_LEDToggle(LED4);
                Delay(1900000);
  }
}
4)Project  選單Bulid 編譯,Debug選單啟動除錯(start  debug session ) 點run 執行程式。
5)led 開始閃爍。
 
如不能正常下載執行程式注意如下設定 Options for  Target ‘Template'